Mod_rewrite on WAMP 2.4

12,608

Solution 1

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]

Solution 2

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>
Share:
12,608
Conner Burnett
Author by

Conner Burnett

Updated on June 04, 2022

Comments

  • Conner Burnett
    Conner Burnett almost 2 years

    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