apache - Domain .htaccess redirect issue -


i'm trying create redirects .htaccess never manage functional. maybe here can me.

what need is:

  1. http://domain.se , http://domain.com redirect http://www.domain.com.

  2. i need http://domain.se/somefolder, http://domain.com/somefolder http://www.domain.se/somefolder redirect http://www.domain.com/folder.

i've tried accomplish myself end errors data not being sent.

options +followsymlinks -multiviews rewriteengine on rewritebase /  # folder rewrite rewriterule ^somefolder$ folder [l]  # domain redirect rewritecond %{http_host} =domain.com [or] rewritecond %{http_host} =domain.se rewriterule (.*) http://www.domain.com/$1 [r=301,l] 
  1. this placed in .htaccess file in website root folder. if placed elsewhere tweaking may required.

  2. first rule rewrite (internal redirect) requests /somefolder /folder. if need 301 permanent redirect, replace [l] [r=301,l]

  3. second rule domain redirect job. rule redirect if domain domain.com or domain.se. if want have redirect domain name (that webserver configured can serve) www.domain.com replace 2 rewritecond lines one: rewritecond %{http_host} !=www.domain.com.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -