URL redirection using .htaccess
.htaccess
The .htaccess file is a small text document that generally sits in the same location as your index.php or index.htm pages. It gives you the ability to interact with Apache on an individual domain-to-domain and directory-to-directory basis.
# This will allow to Redirect index page in site like
(http://domain.com/index.html): Options +FollowSymLinks RewriteCond %{THE_REQUEST} ^.*/index.html RewriteRule ^(.*)index.html$ http://www.yoursite.com/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^.*/index.php RewriteRule ^(.*)index.php$ http://www.yoursite.com/$1 [R=301,L] # This will allow you the Redirection on New Domain: Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] # This will allow you to make All http request to https request for a Domain: RewriteEngine On RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
# For PHPFox script:
RewriteEngine On RewriteCond %{HTTPS} !^on$ RewriteRule (.*) https://yourdomain/$1 [R,L]
NOTE:
The reason you should save the file as htaccess.txt is because many operating systems and FTP applications are unable to read or view
The reason you should save the file as htaccess.txt is because many operating systems and FTP applications are unable to read or view
.htaccess
files by default. Once uploaded to the server you can rename the file to .htaccess
.
Comments
Post a Comment