1

I am using Laravel

Unfortunately Google is picking up the URLs wrong. For example, a page such as: www.domain.co.uk/article/hello-world has been indexed in Google as www.domain.co.uk/public/index.php/article/hello-world.

When you visit the site, all the URLs seem correct and the www.domain.co.uk/article/hello-world URL shows the page as expected, but I guess Google bots are using the .htaccess and viewing the long URL instead

(I had put the public folder which comes with Laravel in public_html)

The .htaccess in public_html has:

RewriteEngine On
Options +FollowSymlinks
Options -Indexes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /public/$1 [l]

And there is an additional .htaccess in the public_html/public folder:

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Does anyone know of any solutions to this issue?

I have tried rewrite rules to redirect the URL when public/index.php is the URL but I am having zero luck. Any tips would be appreciated.

1
  • This might be somewhat off-topic for this site, maybe serverfault would provide better answers. However one tip I can give you is go to Google's webmaster tools google.com/webmasters and you have options to fix things directly with google Commented Aug 19, 2013 at 16:39

1 Answer 1

1

If you are forced by your host to include your files only in the document root, then surely you need only one .htaccess file in the root itself?

Move the file from public/ to the root, and change the rule to:

RewriteRule ^ public/index.php [L]
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.