apache - domain.com/sub redirecting to sub.domain.com/sub -
my main page wordpress, have forum installed on sub-directory. i've set sub-domain @ forum.domain.com
.
going sub-domain works fine, going domain.com/forum
redirects me forum.subdomain.com/forum
tad annoying not website breaking.
i've been fiddling around .htaccess
, mod_rewrite
stuff i'm new i'll end making lasagna instead of working urls. both homepage wordpress installation , forum have .htaccess
files own mod_rewrite
stuff.
any help, insight, , enlightenment appreciated.
you should able achieve using rule in root .htaccess
:
rewriteengine on rewritebase / rewritecond %{http_host} !^sub\.domain\.com/sub$ [nc] rewriterule ^sub/$ http://sub.website.com/sub [l,nc,r=301]
this rule first checks if you're on subdomain, if are, nothing happens. if not on sub.domain.com/sub
redirect it.
make sure clear cache before test this.
edit
i've re-read question number of times , feel above not answer you're looking for. feel you're trying redirect sub.domain.com/sub
sub.domain.com
? if case, need use this:
rewriteengine on rewritebase / rewritecond %{http_host} ^sub\.domain\.com/sub$ [nc] rewriterule ^sub/$ http://sub.website.com [l,nc,r=301]
Comments
Post a Comment