htaccess Issues
htaccess Issues
HTACCESS TO GET RID OF THE NON WWW AND WWW PROBLEM - NOT FOR WINDOWS SERVERS – ONLY FOR UNIX OR LYNUX SERVERS.
STEP 1
Open a .txt file in notepad.
STEP 2
Paste the four lines below into the text file.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*)\.yourdomainname\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomainname.com/$1 [R=301,L]
STEP 3
Replace “yourdomainname” with your domain name.
STEP 4
If you have another domain extension other than .com change the .com in two places.
STEP 5
Save the file as htaccess.txt
STEP 6
Upload the file in ASCII to the root of your server.
STEP 7
Rename the file to .htaccess (Place the “.” dot infront and remove the .txt at the end.
____________________________________________________________________________
HTACCESS AND DYNAMIC URL’S
If your website is hosted on a UNIX / LINUX server and you have .php pages that are generated from a database and the url’s are dynamic (meaning the url’s contain ?and other parameters in them it is advisable to have your website developer modrewrite these pages by using htaccess.
Many content management systems and php scripts allow you to configure search engine friendly url’s.
So instead of having a url that looks like this “propertydetails.php?p=2150″ it would be better to have a url that likes like this “villaforsaleinmarbella.php”
Search engines prefer this.
FURTHER READING – HTACCES
http://www.webmaster-toolkit.com/mod_rewrite-rewriterule-generator.shtml








