can anyone pls tell me the correct version of the 301 redirect code from following 3, 301 redirect codes??? example 1 (currently using) ------------------------------------------------- RewriteEngine ON RewriteCond %{HTTP_HOST} !^(.*).example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] example 2 ------------------------------------------------- RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^http://example.com[NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] example 3 ------------------------------------------------- RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] I prefer www version instead of non www version and I m currently using example 1 code.. is there any difference between these 3 codes???
RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] is the correct way to redirect non-www version to www version.
I'm using this way: # BEGIN WordPress <IfModule mod_rewrite.c> Options +Indexes Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] RewriteCond %{HTTP_HOST} ^www\.xxxxxxxxxxx\.xxx [NC] RewriteRule ^(.*)$ http://xxxxxxxxxxx.xxx/$1 [R=permanent,L] RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://www.xxxxxxxxx.xxx/$1/ [L,R=301] </IfModule> # END WordPress
Hi guys I have seen at many place to redirect url code is redirect301"/domin.html" http://www.domin.com Please tell me where it will be use and what about RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] please guied me
When there is an option of choosing between www n non www domain name in wordpress admin panel, why would be there any need of this redirect? n do we need to add this redirect in htaccess always? or there are special circumstances? e.g first we see our search results n if there are duplicate contents in search results then add this redirect in our htaccess?
RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] is a best way