I just started playing with URL rewriting today and I watched/read a few tutorials but I still don't really get how this rewriting works.
I created a .htaccess file and placed it in my root directory.
I'm currently working on my local machine, using Apache.
I want http://localhost:5216/index.php to redirect to http://localhost:5216/index
In my .htaccess file I have the following:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^index?$ index.php
This doesn't work. I tried refreshing the page, I checked that httpd.conf file has AllowOverride All selected.
I've read a few tutorials and I think I do this the right way but it seems like I don't. What is wrong with my file?
I faced the same problem, and my solution was this (note that I use Laragon with WAMP). It has nothing to do with invidual htaccess files, they are all ignored because of this part in Apache's httpd.conf:
DocumentRoot "D:/laragon/www"
<Directory "D:/laragon/www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Require all granted
</Directory>
So you need to locate your httpd.conf and change AllowOverride None to AllowOverride All. Your .htaccess files should execute now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With