Différences entre les versions de « Apache rewrite rules »
De BlaxWiki
Aller à la navigationAller à la recherche (Page créée avec « Doc Apache : http://httpd.apache.org/docs/1.3/misc/rewriteguide.html Générateur de .htaccess (rewrite rule, auth, page 404... ) : http://cooletips.de/htaccess/ * Redirec... ») |
m (a déplacé Rewrite Rules vers Rewrite rules) |
(Aucune différence)
| |
Version du 30 janvier 2013 à 11:50
Doc Apache : http://httpd.apache.org/docs/1.3/misc/rewriteguide.html
Générateur de .htaccess (rewrite rule, auth, page 404... ) : http://cooletips.de/htaccess/
- Redirection d'une page (ancien domaine vers le nouveaud domaine):
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.
RewriteEngine on
RewriteCond %{HTTP_HOST} mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]