Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RewriteRule on apache2

I have a problem with the Rewrite rules. I'd like to redirect domain.xx/example to domain.xx/index.php?content=example

This would actually work, but I also have a file named example.php in the same folder (domain.xx/example.php). Whenever I open domain.xx/example, the server opens example.php instead of redirecting me to index.php?content=example.

The mod-rewrite is on and works fine when I delete the example.php file.

RewriteEngine On
RewriteBase /
RewriteRule ^example$ index.php?content=example [NC,L]
like image 427
user3119447 Avatar asked Aug 10 '26 22:08

user3119447


1 Answers

That is because of MultiViews option.

Add this line on top of your .htaccess:

Options -MultiViews
like image 100
anubhava Avatar answered Aug 12 '26 10:08

anubhava



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!