: SEO on multilanguage website URL I'm setting up a multilanguage website and I would like to have your help to take the best decision as regard SEO. After reading this. I would like to change
I'm setting up a multilanguage website and I would like to have your help to take the best decision as regard SEO. After reading this.
I would like to change my URLs from this form mywebsite.com/page?lang=es to mywebsite.com/es/page?lang=es. I need to keep the ?lang=es for other things.
My .htaccess file already contains these things (to remove .php extension of page.php).
RewriteCond %{THE_REQUEST} ^GETs.+.php [NC]
RewriteRule ^(.+).php$ / [NE,R=301,L,NC]
RewriteCond %{REQUEST_URI} !.php$ [NC]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule . %{REQUEST_URI}.php [PT]
More posts by @Mendez628
2 Comments
Sorted by latest first Latest Oldest Best
This isn't really an answer to the question, but you may want to bear in mind that Google's guidelines says to avoid using URLs with parameter strings in, for languages or other wise.
So If your making the effort of tidying up your URLs you might as well follow best practices.
Google Guidlines URL structure
Google Guidlines Multilingual sites and URL structure
Something like this will work.
RewriteCond %{QUERY_STRING} ^(lang=es)$
RewriteRule ^$ /es/page.php?lang=es
RewriteRule ^index.php$ /es/page.php?lang=es
Since you can't match against a query string inside a rewrite rule we utilize %{QUERY_STRING}. If you use a relative path, as in the example, you will get a silent redirect (eg. the URL will not change, but apache will serve the new page). If you want a 301 redirect you will have to use the full FQDN URL including the protocol, such as www.example.com/es/page.php?lang=es.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.