Support

Admin Tools

#40244 Rewrite index.php to root

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
4.4
PHP version
8.1
Admin Tools version
7.4.8

Latest post by EIF on Tuesday, 06 February 2024 02:45 CST

EIF

I used the htaccess maker to create the htaccess file. One of the option is to reidrect index.php to the root of the site. I used that for many years.

Now I finally updated my website from J3 to J4. But somehow in this period, Google has indexed many pages with "index.php" in the url. For example: https://www.waterpijp-bong.nl/index.php/bongs/percolator-bongs/d-smoke-stoner-hustler-bong-blue-headshop

As you can see the index.php is in that url. When loadind this URL, it loads the URL just as it is, with index.php in it. I thought that the url should rewrite to non-index.php. But it is not. What code I need to use in the .htaccess?

I just changed your lines with this code:

RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]

But this still acts the same as yours. Isit  possible to rewrite the index.php in the url?

 

 

nicholas
Akeeba Staff
Manager

You cannot and should not change that! SEF URLs like /foo/bar are internally rewritten by the .htaccess file as /index.php/foo/bar which is exactly what allows Joomla to process them. If you try redirecting the URLs with index.php to a URL without index.php you might end up creating a redirect loop.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

EIF

Ok, thanks for clearing this up. I leave it as it is.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!