homepage Welcome to WebmasterWorld Guest from 54.159.161.138
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
301 from index.php to index.html
keyplyr

WebmasterWorld Senior Member keyplyr us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4605677 posted 7:42 am on Aug 29, 2013 (gmt 0)

Using linux/apache on shared hosting.

Been seeing dozens of 404s in logs due to various requests for index.php (I use index.html.) I would think the server config would automatically correct these requests, but I guess not. I do use a nice, friendly 404 error page with site navigation, but many* still leave the site after not getting what they expected.

I'm currently testing: Redirect 301 /index.php http://www.example.com/

Working well, no more 404s. The question is... anything I'm not considering? For example: duplicate content?


*While some requests are from bad agents & vulnerability checks, there are legit user requests requesting index.php.

[edited by: keyplyr at 8:00 am (utc) on Aug 29, 2013]

 

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4605677 posted 7:59 am on Aug 29, 2013 (gmt 0)

if you are using any mod_rewrite directives (RewriteRule) in your .htaccess or server config, you should also use mod_rewrite (instead of mod_alias) for this redirect.

for example, to do a proper canonical hostname redirect, you'll need to use mod_rewrite.


see relevant discussion in this recent Apache Web Server forum thread - Redirect with wildcard not working:
http://www.webmasterworld.com/apache/4604076.htm [webmasterworld.com]

keyplyr

WebmasterWorld Senior Member keyplyr us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4605677 posted 8:05 am on Aug 29, 2013 (gmt 0)

Not internal. No mod_rewrite.

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4605677 posted 8:14 am on Aug 29, 2013 (gmt 0)

no canonical hostname redirect?

keyplyr

WebmasterWorld Senior Member keyplyr us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4605677 posted 8:30 am on Aug 29, 2013 (gmt 0)

no.

Thanks. I got the admin to redirect at the server. Problem solved.

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4605677 posted 10:35 am on Aug 29, 2013 (gmt 0)

would think the server config would automatically correct these requests

Nothing is automatic. If you're on shared hosting, some things may seem to happen magically. But it's only because the host has set it up that way to forestall common problems.

keyplyr

WebmasterWorld Senior Member keyplyr us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4605677 posted 5:28 pm on Aug 29, 2013 (gmt 0)

Ya don't say

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved