: How to enforce WWW without htaccess URL canonization is an important aspect in SEO, now I have a website hosted on Yahoo my small business which doesn't allow for .htaccess to be uploaded,
URL canonization is an important aspect in SEO, now I have a website hosted on Yahoo my small business which doesn't allow for .htaccess to be uploaded, now in such a case how do I keep my domain consistent.
HERE is a Chris coyer script i came across, it shows how to make the URL, consistent using the .htaccess file. but now obviously I can't use the .htaccess file , so how to I make my URL consistent when my host doesn't allow me to upload a .htaccess file?
More posts by @Murray432
1 Comments
Sorted by latest first Latest Oldest Best
You could make a very simple test to see if there is www in the URL, and if it hasn't, go to the www version via a 301 permanently moved header:
if( substr($_SERVER['HTTP_HOST'],0,4)!='www.'){
header('Location: www.'$_SERVER['HTTP_HOST'].'/'.$_SERVER['REQUEST_URI'], true, 301);
}
Don't forget to set your canonical tags to www so bots know your preferred URL.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.