rediriger le www
- remysimpson
- Modérateur
- Messages : 2070
- Enregistré le : ven. 26 août 2016 15:42
rediriger le www
Bonjour ou bonsoir je voudrais rediriger le www vers la meme url sans le www car certain utilisateur mettent le www et malheuresement cela fait de gros tres tres gros bug sur mon site du coup je voudrais faire en sorte que le www disparaisse
Tu as ete la pour moi depuis tout petit j'ai ete la jusqu'a ton dernier souffle
je t'aime mamie
je t'aime mamie
- tttzzz
- Fan de series des années 90
- Messages : 15
- Enregistré le : mer. 12 juil. 2017 12:10
Re: rediriger le www
Bonjour,
Tu peux tester ceci dans ton fichier .htaccess a la racine de ton site :
Tu peux tester ceci dans ton fichier .htaccess a la racine de ton site :
Code : Tout sélectionner
RewriteEngine On
RewriteCond %{SERVER_NAME} ^www.distrcit-tv.ga$
RewriteRule ^(.*)$ http://distrcit-tv.ga$1 [NE,QSA,R=302,L]
- assimilator
- Modérateur
- Messages : 40
- Enregistré le : mar. 8 mars 2016 15:58
Re: rediriger le www
Ajoute ceci dans ton .htaccess c'est celui que j'utilise, j'ai remplacé seulement l'URL pour ton site.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://distrcit-tv.ga/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://distrcit-tv.ga/$1 [R=301,L]
- assimilator
- Modérateur
- Messages : 40
- Enregistré le : mar. 8 mars 2016 15:58
Re: rediriger le www
Autre fonction utile qui peuvent te servir:
IndexIgnore *
AddDefaultCharset UTF-8
#php_flag "register_globals" "off" ### INFOMANIAK auto move in .user.ini
#php_flag "allow_url_fopen" "On" ### INFOMANIAK auto move in .user.ini
#php_flag "allow_url_include" "on" ### INFOMANIAK auto move in .user.ini
#php_flag "allow_rename" "On" ### INFOMANIAK auto move in .user.ini
SetEnv PHPRC /home/$user/public_html/php.ini <---- cette ligne seulement si tu a ce fichier sur ton serveur .php.ini
Options +FollowSymlinks
ServerSignature On
Header unset ETag
FileETag none
Header set Connection keep-alive
# block bad request
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(TRACE|DELETE|TRACK|DEBUG) [NC]
RewriteRule ^(.*)$ - [F,L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /? [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://tonsite.ga/$1 [R=301,L]
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^.]+)$ $1.php [NC,L]
Tu peux aussi ajouter ceci pour le cache ce qui va accélérer le chargement et réduire ainsi des requêtes inutile sur ton serveur... peut-être que tu l'a déjà fait:
# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 7200 seconds"
ExpiresByType image/jpg "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
AddType image/x-icon .ico
ExpiresByType image/ico "access plus 2592000 seconds"
ExpiresByType image/icon "access plus 2592000 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType text/css "access plus 2592000 seconds"
ExpiresByType text/javascript "access plus 2592000 seconds"
ExpiresByType text/html "access plus 7200 seconds"
ExpiresByType application/xhtml+xml "access plus 7200 seconds"
ExpiresByType application/javascript "access plus 2592000 seconds"
ExpiresByType application/x-javascript "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
</IfModule>
# END Expire headers
# BEGIN Cache-Control Headers
<IfModule mod_headers.c>
<FilesMatch "\\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
<FilesMatch "\\.(css)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
<FilesMatch "\\.(js)$">
Header set Cache-Control "max-age=216000, private"
</FilesMatch>
<FilesMatch "\\.(x?html?|php)$">
Header set Cache-Control "max-age=600, private, must-revalidate"
</FilesMatch>
</IfModule>
# END Cache-Control Headers
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE "application/atom+xml" "application/javascript" "application/json" "application/ld+json" "application/manifest+json" "application/rdf+xml" "application/rss+xml" "application/schema+json" "application/vnd.geo+json" "application/vnd.ms-fontobject" "application/x-font-ttf" "application/x-javascript" "application/x-web-app-manifest+json" "application/xhtml+xml" "application/xml" "font/eot" "font/opentype" "image/bmp" "image/svg+xml" "image/vnd.microsoft.icon" "image/x-icon" "text/cache-manifest" "text/css" "text/html" "text/javascript" "text/plain" "text/vcard" "text/vnd.rim.location.xloc" "text/vtt" "text/x-component" "text/x-cross-domain-policy" "text/xml"
Fichier .user.ini adapte les valeurs selon la figuration de ton serveur.
engine = On
zlib.output_compression = On
zend.ze1_compatibility_mode = On
date.timezone = America/Montreal
zlib.output_compression = On
register_globals=off
allow_url_fopen = On
allow_url_include = On
allow_rename = On
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
TimeOut 30
max_execution_time = 30
max_input_time = 30
max_input_vars=30
~/web$ echo -e '<?php echo "memory_limit: " . ini_get("memory_limit") . "\n"; ?>' >memory-limit.php
~/web$ php memory-limit.php
memory_limit: 512M
~/web$ echo 'memory_limit = 640M' >.user.ini
~/web$ php -c .user.ini memory-limit.php
memory_limit: 640M
~/web$
IndexIgnore *
AddDefaultCharset UTF-8
#php_flag "register_globals" "off" ### INFOMANIAK auto move in .user.ini
#php_flag "allow_url_fopen" "On" ### INFOMANIAK auto move in .user.ini
#php_flag "allow_url_include" "on" ### INFOMANIAK auto move in .user.ini
#php_flag "allow_rename" "On" ### INFOMANIAK auto move in .user.ini
SetEnv PHPRC /home/$user/public_html/php.ini <---- cette ligne seulement si tu a ce fichier sur ton serveur .php.ini
Options +FollowSymlinks
ServerSignature On
Header unset ETag
FileETag none
Header set Connection keep-alive
# block bad request
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(TRACE|DELETE|TRACK|DEBUG) [NC]
RewriteRule ^(.*)$ - [F,L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /? [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://tonsite.ga/$1 [R=301,L]
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^.]+)$ $1.php [NC,L]
Tu peux aussi ajouter ceci pour le cache ce qui va accélérer le chargement et réduire ainsi des requêtes inutile sur ton serveur... peut-être que tu l'a déjà fait:
# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 7200 seconds"
ExpiresByType image/jpg "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
AddType image/x-icon .ico
ExpiresByType image/ico "access plus 2592000 seconds"
ExpiresByType image/icon "access plus 2592000 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType text/css "access plus 2592000 seconds"
ExpiresByType text/javascript "access plus 2592000 seconds"
ExpiresByType text/html "access plus 7200 seconds"
ExpiresByType application/xhtml+xml "access plus 7200 seconds"
ExpiresByType application/javascript "access plus 2592000 seconds"
ExpiresByType application/x-javascript "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
</IfModule>
# END Expire headers
# BEGIN Cache-Control Headers
<IfModule mod_headers.c>
<FilesMatch "\\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
<FilesMatch "\\.(css)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
<FilesMatch "\\.(js)$">
Header set Cache-Control "max-age=216000, private"
</FilesMatch>
<FilesMatch "\\.(x?html?|php)$">
Header set Cache-Control "max-age=600, private, must-revalidate"
</FilesMatch>
</IfModule>
# END Cache-Control Headers
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE "application/atom+xml" "application/javascript" "application/json" "application/ld+json" "application/manifest+json" "application/rdf+xml" "application/rss+xml" "application/schema+json" "application/vnd.geo+json" "application/vnd.ms-fontobject" "application/x-font-ttf" "application/x-javascript" "application/x-web-app-manifest+json" "application/xhtml+xml" "application/xml" "font/eot" "font/opentype" "image/bmp" "image/svg+xml" "image/vnd.microsoft.icon" "image/x-icon" "text/cache-manifest" "text/css" "text/html" "text/javascript" "text/plain" "text/vcard" "text/vnd.rim.location.xloc" "text/vtt" "text/x-component" "text/x-cross-domain-policy" "text/xml"
Fichier .user.ini adapte les valeurs selon la figuration de ton serveur.
engine = On
zlib.output_compression = On
zend.ze1_compatibility_mode = On
date.timezone = America/Montreal
zlib.output_compression = On
register_globals=off
allow_url_fopen = On
allow_url_include = On
allow_rename = On
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
TimeOut 30
max_execution_time = 30
max_input_time = 30
max_input_vars=30
~/web$ echo -e '<?php echo "memory_limit: " . ini_get("memory_limit") . "\n"; ?>' >memory-limit.php
~/web$ php memory-limit.php
memory_limit: 512M
~/web$ echo 'memory_limit = 640M' >.user.ini
~/web$ php -c .user.ini memory-limit.php
memory_limit: 640M
~/web$