apache - .htaccess forward 'www.w.' to 'www.' -


i have weird issue google indexing several of site's pages 'www.w.example.com' causing issues security certificate.

while i'm looking solution, i'd redirect using .htaccess can't seem work.

currently have:

rewriterule ^(.*)www\.w\.(.*)$/$ https://www.$1/$2 [r=301,l] 

but doesn't seem work..

i have multiple domains site ideally needs redirect correct domain e.g. https://www.example1.com or https://www.example2.com

you need use rewritecond matching host name:

rewriteengine on  rewritecond %{http_host} ^www\.w\.(.+) [nc] rewriterule ^ http://www.%1%{request_uri} [r=301,l,ne] 

however might still ssl cert warning because cert negotiation happens before mod_rewrite rules invoked.


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -