开发者

Links from Google appending index.php to my URL

I recently put up a site and I have been doing some SEO. However I noticed that links from Google search append index.php to my links.

For example a site page which clearly appears as www.example.com/index/why on search together with correct content sample when cl开发者_如何学Cicked on ends up in the new browser as www.example.com/index.php/why

Note that on my site all links are redirected to SSL and I use the MVC stucture.

Any directives that am may be missing?

My .htaccess file is as below

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
#RewriteCond %{QUERY_STRING} !vardump


This might be some kind of URL rewrite / redirection issue at your site. Try viewing the net requests while clicking on the incoming link in Firebug to make sure there is no weird redirection at your own website.

Edit: The second last line in your htaccess file causes the unwanted redirection you are describing.


I found a solution to my problem and I decided to write the .htaccess rule/condition that saved the day.

RewriteCond %{HTTPS} !^on$
RewriteRule ^(index).php(/.*) https://%{HTTP_HOST}/$1$2 [R,L]

Hope this helps someone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜