.htaccess - 301 redirect everything to new website root/whole site including sub pages? Moved Permanently -


quick update

ok getting there mod_alias?

redirectmatch 301 ^/ http://brightmist.co.uk/ 

i've added 1 line of code underneath , appears work, other directories such http://brightmist.co.uk/blog/2013/02/23/manchester-art-gallery-feb-2013 telling google these pages have temporarily moved - see http://www.internetofficer.com/seo-tool/redirect-check/

does mean have go right way though site , add tone of redirects?


original question

i have new website. i'd redirect of old site links http://artygirl.co.uk new 1 http://brightmist.co.uk/

i'm designer years of experience using in photoshop, css, html, wordpress, , jquery don't know editing things htaccess file. , don't want wrong means google ranking drops etc

does know of script can paste bottom of htaccess file, i'd redirect links/pages on site same place before. example if type http://artygirl.co.uk/buy-art-prints-cheshire/ want go http://brightmist.co.uk/buy-art-prints-cheshire/ i'm using same host, they've re-pointed domain

among other things host has added following code, assume domain mapping, here whole htaccess file -

errordocument 401 /forms/401.html errordocument 403 /forms/403.html  rewriteengine on rewritebase /  #uploaded files rewriterule ^(.*/)?files/$ index.php [l] rewritecond %{request_uri} !.*wp-content/plugins.* rewriterule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [l]  # add trailing slash /wp-admin rewritecond %{request_uri} ^.*/wp-admin$ rewriterule ^(.+)$ $1/ [r=301,l]  rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -d rewriterule . - [l] rewriterule  ^([_0-9a-za-z-]+/)?(wp-.*) $2 [l] rewriterule  ^([_0-9a-za-z-]+/)?(.*\.php)$ $2 [l] rewriterule . index.php [l]  <ifmodule mod_security.c> <files async-upload.php> secfilterengine off secfilterscanpost off </files> </ifmodule>  <files 403.shtml> order allow,deny allow </files>  deny 218.143.4.127 deny 143.90.221.204 deny 95.135.78.190 deny 114.108.150.74 deny 95.135.111.205 deny 91.124.239.150 deny 94.178.2.93 deny 91.124.206.118 deny 91.124.226.116 deny 118.98.32.34 deny 94.180.252.133 deny 58.27.140.58 deny 77.93.197.83 deny 88.191.63.27  # hotlink protection start #  rewriteengine on rewritecond %{http_referer} !^$ rewritecond %{http_referer} !^http(s)?://(www\.)?brightmist.co.uk [nc] rewritecond %{http_referer} !^http(s)?://(www\.)?google.com [nc] rewriterule \.(jpg|jpeg|png|gif)$ - [nc,f,l]  # hotlink protection end # 

i'd redirect of old site links http://artygirl.co.uk/ new 1 http://brightmist.co.uk/

there several ways achieve that, of them should implemented in 1 .htaccess file in http://artygirl.co.uk/ root directory.

there no need check incoming domain must artygirl.co.uk, .htaccess file located.

to use of following options, copy-paste corresponding directive or rule-set 1 empty .htaccess file in http://artygirl.co.uk root directory.


the fastest 1 simple redirect using 1 mod_alias directive:

redirect 301 /  http://brightmist.co.uk/ 

any path in incoming url appended automatically redirected url.


to redirect paths using mod_alias directive:

redirectmatch 301 ^/(.*)  http://brightmist.co.uk/$1 

although example redirects everything, regex ^/(.*) can modified match url-path pattern.


to redirect paths using mod_rewrite directives:

options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)   http://brightmist.co.uk/$1  [r=301,nc,qsa,l] 

as in previous option, although rule-set redirects everything, regex ^(.*) can modified match url-path pattern.


notes

  • the same directory structure , files in http://artygirl.co.uk/ must exist in http://brightmist.co.uk/ of previous options work.

  • if actual .htaccess file in question works expected, use in http://brightmist.co.uk/ root directory new wp installed. might require modifications, though.

  • to move or copy wp install, check link changing site url.


update:

from these sentences in comment answer: "my domains both point @ same directory..." , "...now creates loop...", maybe question domains pointing same content (website), known parked domains.

if that's case, not sure redirecting in .htaccess primary domain parked 1 correct approach change domain name in browser's address bar.

however, in theory should using mod_rewrite directives:

options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{http_host}  artygirl\.co\.uk      [nc] rewriterule ^(.*)   http://brightmist.co.uk/$1  [r=301,nc,qsa,l] 

redirects permanently request http://artygirl.co.uk http://brightmist.co.uk, appending complete incoming path , query when present.

since .htaccess file shared, think rule-set should placed @ top of .htaccess file in question, replacing following lines:

rewriteengine on rewritebase / 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -