SMF Support > SMF 2.0.x Support

Redirect index.php to root does not work

(1/4) > >>

James---:
Hello,

I try to 301 redirect the /index.php page of my forum to the root page (so the forum's homepage without anything after the domainname).

How to redirect /index.php to / ? That's our goal.

Strange problem:
The problem here is that we're getting a strange page when we create the 301 redirection.
After we created the 301 redirect from index.php to root we're not getting our normal forum's homepage (with all the boards on it etc.)
but we are getting a "Moved Permantely" page. With a message like: "the document you are trying to reach is moved here".
When we click on the word "here" (which is a hyperlink), we stay on the same page.

Looks like the redirect does not work properly. We already created a 301 redirect to direct all non www traffic to the www pages of our forum. Could this redirect generate a conflict with each other?

Colin:
The way SMF works requires you to use index.php.

MrPhil:
You normally can't redirect /index.php to /, as logically they're identical (the server searches through a list of "index" files until it finds a match). You're likely to end up in an endless loop. What exactly are you trying to accomplish? A user doesn't need to type in index.php, so long as there's no index.html or index.htm to get picked up first. A 301 redirect would be the wrong approach, anyway, as all it does is bounce the GET request back to the browser and say, "try again with this URL".

I recall seeing discussion from time to time about getting rid of "index.php" from SMF-generated links, so I think that can be done. If you're not using SEO, you would see something like http://mydomain.com/?topic=476051. That doesn't seem much of an improvement. If you're using SEO, maybe some forms of it will get rid of the "index.php" for you.

Doctor Deejay:
Please attach Sources/QueryString.php :)

Arantor:
If you're thinking of doing the tiny hack that rewrites $scripturl to not include index.php, DON'T. IT WILL BREAK OTHER THINGS, notably the PHPSESSID re-injector, which screws up the site layout for the first visit on users.

There is absolutely no need to remove index.php and honestly your life will be simpler if you leave it as it is.

Navigation

[0] Message Index

[#] Next page

Go to full version