1

I want to be able to remove index.php URL from google's search listing, you may be able to see this when searching the website title (with or without a space between). On the second page for me it shows my website however the URL has index.php on the end!

I have edited the httpd.conf to remove index.php from the end of my URL, below you can see what I have:

<VirtualHost *:80>
    ServerName joemethven.com
    DocumentRoot /var/www/html/joemethven/
</VirtualHost>

Options -MultiViews

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]

Why is Google picking up index.php when the website loads with joemethven.com? Is there a way I can prevent this?!

Thanks for reading, hope someone can help! :)

Update: I just quickly added a .htaccess within the folder of my website with the below information:

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.*)$ $1.html

RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

I don't know if this will make any changes, however my other servers running websites without this issue had this information in their .htaccess file.

1 Answer 1

1

The fix was easier than I thought, simply going to Google's webmaster tools I used the "Submit to Index" function and set my preferred URL without index.php and it's changed over for me!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.