Question
Redirect index.php to / only in main folder
Hello,
I am using LEMP droplet. For SEO purposes, I made redirection from site.com/index.php to site.com like this:
server {
...
if ($request_uri ~* "^(.*/)index\.php$") {
return 301 $1;
}
...
}
It works just fine, but I need it to work on root folder of the site only. It currently redirects all folders, in example /folder/index.php will be redirected to /folder/
This prevents some of my scripts to work normally (Joomla backend in example). How can I change the above code and make this redirection for root folder only.
Thanks,
Milos
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×