Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- index.php redirect breaking 404 pages.


Sgt_Kickaxe - 5:14 am on Dec 10, 2012 (gmt 0)


Ack, beaking...

As g1smd said, it's about example.com/index.php/page-name being redirected to www.example.com/page-name

If the www is missing or the index.php/ is in the requested url, or both, the page redirects as it should, once via 301.

If either the www is missing or the index.php/ is in the requested url, or both, AND the request is to /old-page-name which I redirect to /page-name then the result is a double redirect. The server first redirects to www.example.com/old-page-name(adding www and removing index.php) and then redirects again immediately to www.example.com/page-name, both redirects via 301.

It's not a problem for my ursers, it's googlebot that's fumbling around with it in my logs and I imagine it's not helping rankings any.

I get the same problem without wordpress on this server. I've tried a lot of things, here is the latest .htaccess try...

Options -Indexes
Options +FollowSymLinks
Options -MultiViews
RewriteEngine on
RewriteBase / <--- required on this host

# permanently redirected page
RewriteRule ^some-old-url$ http://www.example.com/my-new-url [R=301,L]

# redirect requests containing index.php/ to their NON index.php/ version
rewritecond %{THE_REQUEST} ^[A-Z]+\ /index\.php(/[^\ ]*)?\ HTTP/
rewriterule ^index\.php(/(.*))?$ http://www.example.com$1 [R=301,L]

# add www if it is missing
rewritecond %{HTTP_HOST} !^(www\.example\.com)?$ [NC]
rewriterule (.*) http://www.example.com/$2 [R=301,L]



... yet example.com/index.php/some-old-url still redirects twice to get to www.example.com/my-new-url when the first rule *should* have caught it all in one step. Is the server ignoring anything after the .php with my first rule like it does when there are parameters?

e.g. www.example.com/some-old-url?para=12345 is redirected by the first rule despite not matching it exactly. I'm not an expert, scratching for ideas here...


Thread source:: http://www.webmasterworld.com/apache/4520914.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com