Remove index.php BUT keep old links working

Remove index.php BUT keep old links working

Tuesday 15 September 2009 10:02:14 pm - 12 replies

Author Message

Greg McAvoy-Jensen

Tuesday 15 September 2009 10:11:33 pm

Vivienne,

Try adding a rewrite rule to your virtual host file.

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

V. van Velzen

Tuesday 15 September 2009 10:52:12 pm

Hi Greg,

I tried adding a rewrite rule in the .htaccess file, but apparently am not very proficient with the way .htaccess works as I could not get this to work. What I tried:

RewriteCond ^index.php(.*)$
RewriteRule ^index.php(.*)$ $1 [L]
RewriteRule .* index.php [L]

The third line was already present to make the virtual host setup work.
Any help would be appreciated.

Vivienne

V. van Velzen

Wednesday 16 September 2009 10:27:30 pm

Good morning,

I'm still thinking this should be possible, but that there is an error in my .htaccess syntax (see previous post). Has anyone else run into this problem and was able to fix it using .htaccess? I'd appreciate any help.
TIA,

Vivienne

Peter Keung

Friday 18 September 2009 12:03:10 am

Try being explicit with the domain in the rewrite rule:

RewriteRule ^/index\.php(.*)$ http://www.yoursite.com$1 [R=301, L]

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

V. van Velzen

Monday 21 September 2009 6:46:14 am

Hi Peter,

Thank you for the suggestion, but it (sadly) does not work. These are the lines I have in my .htaccess file:

###
RewriteCond %{REQUEST_URI} ^/index.php
RewriteRule ^index\.php(.*) http://www.mysite.com$1

RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule .* index.php [L]
###

This causes the browser to show an error message (which is logical in my eyes, as it creates an infinite loop), but I can't see another way to achieve my goal.
Hasn't anyone switched from using index.php to not using it, and found a working solution to make sure the old index.php links are still working?
TIA,

Vivienne

V. van Velzen

Wednesday 23 September 2009 9:29:22 pm

Hi all,

Sorry for bumping this message, but it's pretty important to get this to work. Does anyone have a solution to the problem of removing the index.php from the address, but keeping the old addresses with index.php working? Pretty important from a SEO perspective...
TIA,

Vivienne

Gaetano Giunta

Thursday 24 September 2009 1:08:31 am

Rewrite rules are the way to go - you just have to find out the correct set...

Principal Consultant International Business
Member of the Community Project Board

V. van Velzen

Thursday 24 September 2009 1:41:58 am

Yes, but that seems to be the problem in my case. As you can see in a previous post, I get an infinite loop trying it my way. So any help would be appreciated.

Vivienne

Neo Pixel

Thursday 01 October 2009 5:11:34 am

Are you sure you added

[SiteAccessSettings]
ForceVirtualHost=true

to the correct site.ini.append.php?

Mine are usually in settings/siteaccess/eng/site.ini.append.php ???

Asking stupid questions so you don't have to!

V. van Velzen

Monday 05 October 2009 12:00:10 am

Hi Neo,

Yes, I've added the ForceVirtualHost to the correct site.ini.append.php file. I don't have any problems removing the index.php from the address, I just can't do it in such a way that old links using index.php still work (i.e. links from Google search results). Any help would still be appreciated, as I've yet to find a solution.
TIA,

Vivienne

Neo Pixel

Monday 05 October 2009 5:30:00 am

Hi Vivienne,

I wouldn't worry too much about retaining the google results. If you resubmit the site to google to indictae a fundamental change then the spiders will soon be round to find everything again.

:-)

Asking stupid questions so you don't have to!

V. van Velzen

Tuesday 06 October 2009 2:31:03 am

True, but not only Google has links to the 'old' index.php pages. The site itself also contains those links (complete links added through the EZPublish CMS), as do other 'friendly' sites. And even though we would go through our site to repair those links, in my opinion it's a better practice to just keep those links working...

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.