tags:

views:

33

answers:

2

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 clicked 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
+1  A: 

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.

Adrian Grigore
Adrian I have added the htaccess file for more information.
davykiash
Interesting because I use Zend MVC and it is necessary since all requests have to go through the index.php file.Any rewrite rule I could use for this specific problem?
davykiash
I'm sorry, but I don't really understand the problem. I don't know anything about Zend MVC, but from what you are saying it looks like the redirection through index.php is exactly how the framework is expected to work. Also, it seems that you have no problem with the web bage not being displayed correctly. So if nothing is broken, why do you want to change anything in the first place? Also, what exactly do you want to get in the end?
Adrian Grigore
The problem is that the page does not display if you click the link from Google Search.I know the problem is as a result of that redirect and I was looking for a way to best solve it.
davykiash
A: 

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.

davykiash