- First of all you have need to check the RewriteEngine is "on" or not in your htaccess file. if not then add the given code in top of the file RewriteEngine on
- How redirect site form NON-WWW to WWW url using htaccess?
##non-www to www RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
- How redirect site from WWW to NON-WWW url using htaccess?
pre>
## www to non-www RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteRule ^(.*)$ %{HTTP_HOST}$1 [C] RewriteRule ^www\.(.*)$ http://$1 [L,R=301]
- How create a single line code for read ".php" files as ".html using htaccess"?
## Add rewrite rule for call ".php" pages as ".html" pages # Example about-us.php file will be read as about-us.html Options +Indexes Options +FollowSymlinks RewriteRule ^([^.]+)\.html$ $1.php [L]
- How remove the index.php OR index.html from the site url using htaccess
RewriteRule ^(.*)index\.(htm|html|php)$ http://%{HTTP_HOST}/$1 [R=301,L]
- How redirect Old Site to new New Site?
RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR] RewriteCond %{HTTP_HOST} ^www.mrwebsolution.com$ RewriteRule (.*)$ http://www.mrwebsolution.com/$1 [R=301,L]
- How redirect all pages URL HTTP to HTTPS?
RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://mrwebsolution.com/$1 [R,L]
- How add 301 redirection on all old pages that have a common suffix url to any other page?
Example:
mrwebsolution.in/go/news.release/id/43
mrwebsolution.in/go/news.release&id=57
These type of all url will be redirect to home page
RewriteRule ^/?go/(.*)$ http://www.mrwebsolution.in/? [L,R=301]
- How add 301 redirection for sitemap.xml and robots.txt non-www url to www url
RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(sitemap\.xml|robots\.txt)$ http://www.%{HTTP_HOST}/$1 [L,R=301,NC]
- How create new rewrite rule for custom page url
RewriteEngine On Options +FollowSymlinks -MultiViews RewriteEngine on RewriteBase / RewriteRule ^forsale/?$ index.php?SearchType=ByLocation&Purpose=1&IsFeatured=0 [NC,L] RewriteCond %{THE_REQUEST} ^.*/index.php RewriteRule ^(.*)index.php$ http://localhost/aqarynet/$1 [R=301,L] RewriteRule ^([^/]*)\.html$ /contents.php?pageid=$1 [L] RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /?SearchType=$1&Purpose=$2&IsFeatured=$3 [L] RewriteRule ^pid/([^/]*)\.html$ /property_details.php?pid=$1 [L] RewriteRule ^rid/([^/]*)\.html$ /realestate_details.php?rid=$1 [L] RewriteRule ^nid/([^/]*)\.html$ /news_details.php?nid=$1 [L] RewriteRule ^PageIndex/([^/]*)\.html$ /news.php?PageIndex=$1 [L] RewriteRule ^PageIndex/([^/]*)/rpp/([^/]*)\.html$ /realestate.php?PageIndex=$1&rpp=$2 [L]
Some useful scripts for manage your site through the htaccess
Hello Friends!
Hope you are doing well :)
I am here going to tell you some useful script for manage .htaccess file of your website.
Thank you Raghu Ji. I m Using your social sharing buttons on my site http://www.bloggchat.com. Thanks a lot. Nice work bro.