Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Help Testing mod_rewrite on apache 2.4
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1341

PostPosted: Wed Oct 02, 2013 10:48 pm    Post subject: Help Testing mod_rewrite on apache 2.4 Reply with quote

Greetings all I am testing out mod_rewrite on apache 2.4

I have a directory called test in htdocs.
I have 2 files index.html
And rewriteme.html
my rewrite rule is:
Code:

Alias /test /var/www/localhost/htdocs/test/

<Directory test>
  RewriteEngine On

  RewriteRule ^/test/?$ /test/rewriteme.html [R]
  #RewriteRule ^/test/* /test/rewriteme.html [R]
  # Next test the HTTP Authorization data should be passed
  # to the CGI scripts running from this directory
  #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</Directory>

Which I think says anything I try to go to in test will redirect me to test/rewriteme.html
however when I go to localhost/test I can see index.html's contents.
Any thoughts?

EDIT: I don't have to put anything special in /etc/conf.d/apache2 do I ?
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1341

PostPosted: Thu Oct 03, 2013 6:26 pm    Post subject: Reply with quote

Fixed it. Funny apache bug mod_rewrite can not use an alias.
Something like this should be a good test if you have mod_rewrite working.

Quote:
#DocumentRoot /var/www/localhost/htdocs/test
Alias /test /var/www/localhost/htdocs/test
<Directory /var/www/localhost/htdocs/test/>
RewriteBase /test/
RewriteEngine On
RewriteRule ^wrong.html$ correct.html [R]
Require all granted
</Directory>


Got my answer here:
http://unix.stackexchange.com/questions/93460/how-to-configure-mod-rewrite-with-an-alias-in-apache-2-4
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum