Forum Moderators: phranque

Message Too Old, No Replies

How would I use.htaccess to remove a folder name permanetly site wide

Turning example.com/index.php/yadda into example.com/yadda help needed.

         

JS_Harris

7:35 pm on Dec 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm going to be moving a site from one host to another and would like some .htaccess guidance.

Current URLs
example.com/index.php/widgets

Desired URLs
example.com/widgets

I need the index.php/ removed sitewide, every article, with a permanent redirect from one version to the other.

The new host allows .htaccess but the old host never did which is why the index.php is in every URI.

note: The index page does NOT have index.php added, just every single other page.

Thanks for any examples you can provide, I want to get it right first shot.

g1smd

8:12 pm on Dec 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Change the links on your pages to the new format. It is the links that define URLs.

What happens next depends on where on the server the content will reside in the future.

I assume there is not a folder called /index.php/ but instead you have a rewrite to connect the old URL to some dynamic filepath.

The big question is, are you keeping the physical files in the same place as before and using the same parameters as before?

Once that is all known it then very easy to craft the redirect from old URL to new URL, and the rewrite from new URL to real internal server filepath.

JS_Harris

9:04 pm on Dec 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It's wordpress and no there is no folder called /index.php
My current host does not allow .htaccess but semi pretty permalinks were possible with /index.php added (the results was http://www.example.com/index.php/article-title-here). The new host has .htaccess and all articles will be in the new format location, ie:http://www.example.com/article-title-here.

I need a permanent redirect to send people to the NON /index.php containing version of pages.

so basicly it needs to do two things.
#1 - strip the /index.php from all uri's whenever it is asked for and
#2 - be permanent so that search engines update as well.

g1smd

9:12 pm on Dec 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sure. There are hundreds of examples of that type of code here in the forum.

Please post your best effort code as a basis for discussion (and check the details on my previous post).