How to get rid of "mydomain/index.php?mypage"
Posted: Thu Aug 14, 2014 11:33 am
After having made a website and searching it in Google I find that Google answers with 2 sites:
Why that?
Why that?
Welcome to the CMSimple_XH–Community!
https://cmsimpleforum.com/
Code: Select all
RewriteEnginge On
RewriteCond %{REQUEST_URI} /index\.php
RewriteRule ^index\.php / [QSA,L,R=301]
I would think this is a serious flaw. The possibility to access the page either way means duplicated content which should be avoided.cmb wrote:Because it is possible to access the page either way (i.e. with or without index.php),
No, no, no, certainly not, I don't want uselessly elongated links. I just want this index.php to disappear from the Google listing. Normal people would never use it.cmb wrote:To rewrite all requests with an explicit index.php,
I'm not sure whether this case is regarded as DC by search engines. Anyway, we can't ship a prepared .htaccess, because that would require mod_rewrite--otherwise the site might not be accessible. And a worse case of DC is http://www.example.com/ vs. http://example.com/. These issues should be documented in the Wiki.svasti wrote:I would think this is a serious flaw. The possibility to access the page either way means duplicated content which should be avoided.
Code: Select all
<link rel="canonical" href="http://3-magi.net/">
Maybe the core or a plugin has created such a link on a page. Maybe the site (containing index.php) has been submitted somewhere. Maybe somebody has deliberately posted such a link somewhere. Lots of possibilities.svasti wrote:But how does Google come to link to the index.php? Usually one never uses such explicit links.
That is a misunderstanding. The .htaccess code is meant remove index.php from incoming requests. The 301 status code shall cause Google to correct the links (may take some time, though).svasti wrote:No, no, no, certainly not, I don't want uselessly elongated links. I just want this index.php to disappear from the Google listing. Normal people would never use it.cmb wrote:To rewrite all requests with an explicit index.php,
Code: Select all
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.22 Server at www.sachverstand-bauhandwerk.de Port 80
Yes, that's probably best. You may want to consider to add a rewrite rule to redirect from http://example.com/ to http://www.example.com/:svasti wrote:I went through it and nowhere there is mod_rewrite
Seems no to be enabled. I'll see if it can be enabled.
Code: Select all
RewriteEnginge On
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} /index\.php
RewriteRule ^index\.php / [QSA,L,R=301]
I had tested this on localhost (Apache 2.4.4) as well as on 3-magi.net (Apache 2.?). You might have to debug the issue.svasti wrote:I just tried your .htaccess on my own server (different hoster), where mod_rewrite can be found in the php-info, and got the same answer. Hm, I guess something's wrong somewhere.