Showing posts with label mod_rewrite apache. Show all posts
Showing posts with label mod_rewrite apache. Show all posts
A .htaccess rule that will divert any page in another folder
Posted by Raj
A .htaccess rule that will divert any page in another folder
1)If you want to redirect http://test.com/f1/ to http://test.com/f2/.
.htaccess file will be.
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^f1.*$ http://test.com/f2/ [R=301,L]
2)If you want to redirect http://test.com/f1/test.html to http://test.com/f2/test.html.
.htaccess file will be.
Options +FollowSymLinks
RewriteEngine On
RewriteRule RewriteRule ^f1/(.*)$ http://test.com/f2/$1 [R=301,L]
3) If you want to redirect http://test.com/ to http://www.test.com/.
.htaccess file will be.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^test.com [NC]
RewriteRule ^(.*)$ http://www.test.com/$1 [R=301,L]
4) If you want to redirect http://test.com/ to https://test.com/.
.htaccess file will be.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.test.com/$1 [R,L]
1)If you want to redirect http://test.com/f1/ to http://test.com/f2/.
.htaccess file will be.
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^f1.*$ http://test.com/f2/ [R=301,L]
2)If you want to redirect http://test.com/f1/test.html to http://test.com/f2/test.html.
.htaccess file will be.
Options +FollowSymLinks
RewriteEngine On
RewriteRule RewriteRule ^f1/(.*)$ http://test.com/f2/$1 [R=301,L]
3) If you want to redirect http://test.com/ to http://www.test.com/.
.htaccess file will be.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^test.com [NC]
RewriteRule ^(.*)$ http://www.test.com/$1 [R=301,L]
4) If you want to redirect http://test.com/ to https://test.com/.
.htaccess file will be.
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.test.com/$1 [R,L]
How to Enable mod_rewrite in Apache Server
Posted by Raj
how to create a website server,how to make a website server,enabling mod_rewrite,mod_rewrite module,mod_rewrite url,mod_rewrite examples,apache install mod_rewrite,httpd mod_rewrite,apache2 install mod_rewrite,apache enable mod rewrite
1. please make sure you make a backup copy of the original file in case you make a mistake.
2. Find the httpd.conf file
3. Inside the httpd.conf file find and uncomment the line LoadModule rewrite_module modules/mod_rewrite.
4. After you have made the changes and saved them, restart your httpd (apache) server for the changes to take affect.
6. Done.
Check if its working
Create a .htaccess file (a text file named .htaccess) with the following code in it
Options +FollowSymLinks
RewriteEngine On
Save the file to a subdirectory of your main site something like this
/project/.htaccess
browse to the subdirectory (http://localhost/project/).
- No errors Congrats mod_rewrite engine is now enabled.
- 500, Internal Server Error If you get this message then mod_rewrite was not installed/enabled on your computer.