Conner Burnett
Conner Burnett

Reputation: 512

Mod_rewrite on WAMP 2.4

I have wampserver 2.4 and I can not seem to get Mod_Rewrite to work on it. I have enabled it in the Apache services and uncommented the mod_rewrite.so in the httpd.conf and restarted the server. I also checked my phpinfo() and it listed mod_rewrite under services.

The site I am testing it on is behind the address localhost/eb/index.php I was trying to test it on the event.php page in which the url looks like localhost/eb/event.php?id=1

This is what my .htaccess file looks like in the root of localhost/eb where my index.php file is located.

<IfModule mod_rewrite.so>
RewriteEngine on
RewriteBase /eb/
RewriteRule ^event/([0-9]+)/?$event.php?id=$1
</IfModule>

Even after this it still displays the url localhost/eb/event.php?id=1

Upvotes: 2

Views: 12803

Answers (2)

anubhava
anubhava

Reputation: 785156

You need an additional for external redirect also. Keep your .htaccess like this:

Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /eb/

RewriteCond %{THE_REQUEST} /event\.php\?id=([^\s&]+) [NC]
RewriteRule ^ event/%1? [R=301,L]

RewriteRule ^event/([0-9]+)/?$ event.php?id=$1 [L,QSA]

Upvotes: 2

hodl
hodl

Reputation: 1420

add the RewriteBase /eb/ on document root instead of /eb/ directory and add your all your rewrites on /eb/ directory.

update

On your http.conf

<Directory *>            
   # changed from None to FileInfo
   AllowOverride FileInfo          
</Directory>

Upvotes: 2

Related Questions