Domanda

Usando OpenCart Come userei un reindirizzamento 301 per aggiungere www. al dominio

.htaccess contenuto:

#Options +FollowSymlinks

<IfModule mod_rewrite.c>
RewriteEngine On

#OPENCART REWRITES START
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php
#OPENCART REWRITES END

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC]
RewriteRule ^(.*)$ http://www\.mysite\.com/$1 [R=301,L]
</IfModule>

Si noti che 302 reindirizzamenti funzionano

È stato utile?

Soluzione

Penso che tutto ciò che vuoi fare sia questo all'interno del tuo file di configurazione Apache.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L] 

Altri suggerimenti

Uso in questo modo:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.net
RewriteRule ^(.*)$ http://www.mysite.net/$1 [R=permanent,L]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top