How to redirect indexed pages that include index.php in the url to the url without it Topic is solved

Discuss Search Engine Optimization in relation to Joomla! 3.x. This forum will also have discussions on SEF/SEO Joomla! 3.x extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
RobinClapp
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Wed Jan 16, 2008 2:46 am
Contact:

How to redirect indexed pages that include index.php in the url to the url without it

Post by RobinClapp » Thu Aug 11, 2022 2:04 pm

Hi, I am inheriting a large site that is fully indexed. And all the pages have index.php in the url.

sitename.com/index.php
sitename.com/index.php/nationalnews.html

I know how to remove the index.php by enabling URL rewriting and changing to .htaccess

My question is, is there a way to permanently redirect all traffic from sitename.com/index.php to sitename.com? Including all other urls also, sitename.com/index.php/nationalnews.html to sitename.com/nationalnews.html?

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44097
Joined: Sat Apr 05, 2008 9:58 pm

Re: How to redirect indexed pages that include index.php in the url to the url without it

Post by Webdongle » Thu Aug 11, 2022 7:43 pm

Enable the Redirect plugin and select the 'Collect URLs' option. Then use the redirect component to redirect each one.
Or us the .htaccess try
Redirect *.html http://yoursite.com/
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12787
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: How to redirect indexed pages that include index.php in the url to the url without it

Post by brian » Thu Aug 11, 2022 9:49 pm

RewriteEngine On
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

RobinClapp
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Wed Jan 16, 2008 2:46 am
Contact:

Re: How to redirect indexed pages that include index.php in the url to the url without it

Post by RobinClapp » Fri Aug 12, 2022 2:04 pm

Thank you so much!

User avatar
mojito
Joomla! Guru
Joomla! Guru
Posts: 755
Joined: Wed Sep 07, 2005 10:18 pm
Location: London
Contact:

Re: How to redirect indexed pages that include index.php in the url to the url without it

Post by mojito » Wed Mar 01, 2023 1:54 pm

Brians solution works on the frontend but breaks the backend for me. Anyone else? I am looking for a way to not alter admin style urls so they still work. TY
I am a freelance SEO (https://cambs.eu) web designer and developer working with Wordpress and Joomla since Mambo.

User avatar
mojito
Joomla! Guru
Joomla! Guru
Posts: 755
Joined: Wed Sep 07, 2005 10:18 pm
Location: London
Contact:

Re: How to redirect indexed pages that include index.php in the url to the url without it

Post by mojito » Wed Mar 01, 2023 4:31 pm

This seems to work so far

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/administrator
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^index(.*) / [R=301,L]
I am a freelance SEO (https://cambs.eu) web designer and developer working with Wordpress and Joomla since Mambo.


Locked

Return to “Search Engine Optimization (Joomla! SEO) in Joomla! 3.x”