Sunday, 19 February 2017

.htaccess redirect url

February 19, 2017

What is .htaccess  file ?
htaccess is a configuration file for use on web servers running the Apache Web Server software. When a .htaccess file is placed in a directory which is in turn 'loaded via the Apache Web Server', then the .htaccess file is detected and executed by the Apache Web Server software. These .htaccess files can be used to alter the configuration of the Apache Web Server software to enable/disable additional functionality and features that the Apache Web Server software has to offer. These facilities include basic redirect functionality, for instance if a 404 file not found error occurs, or for more advanced functions such as content password protection or image hot link prevention.


htaccess  redirect:
.htaccess files can be used to make redirects. Below are some common examples.
Redirect from old domain to new domain
You can use the code below if you have changed domain and want users on your old domain to be redirected to your new domain.
RewriteEngine on
RewriteRule ^(.*)$ http://www.your-new-domain.com/$1 [R=301,L]
If a user visits http://www.olddomain.com/articles.php he will be redirected to the same page on your-new-domain.com. The R=301 part make it a permanent redirect by sending a “301 Moved Permanently” status code to the user’s browser. If the user happens to visits the same page on your old domain, the browser will automatically redirect to the new domain.
Redirect to www
So you only want users to visit www.mydomain.com and not domain.com? Htaccess redirects can solve this too. Copy the code below into a .htaccess for redirecting all visits to your www domain.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]

For example .htaccess   for   Domain name  www.funmoviemasti.com :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^funmoviemasti.com [NC]
RewriteRule ^(.*)$ http://www.funmoviemasti.com/$1 [R=301,L]


Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 comments:

Post a Comment

 

© 2013 Digital Marketing by Om Sir. All rights resevered. Designed by Templateism

Back To Top