Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Recently I added a domain to one of my websites: Original domain: ss.rsportugal.org New domain: supremeskillers.net

I used this .htaccess file to force redirects ~/public_html/ss/.htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} !^supremeskillers\.net$ [NC]
RewriteRule ^/?(.*) http://supremeskillers.net/$1 [L,R=301]

But redirects aren't working for the forum subdirectory and I wonder if the problem is the 'pretty urls' .htaccess: ~/public_html/ss/forum/.htaccess

RewriteEngine on
RewriteBase /forum

# Rules for: actions
RewriteRule ^(activate|admin|announce|attachapprove|buddy|calendar|clock|collapse)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(coppa|credits|deletemsg|display|dlattach|editpoll|editpoll2|emailuser)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(findmember|groups|help|helpadmin|im|jseditor|jsmodify|jsoption)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(lock|lockvoting|login|login2|logout|markasread|mergetopics|mlist)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(moderate|modifycat|modifykarma|movetopic|movetopic2|notify|notifyboard|openidreturn)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(pm|post|post2|printpage|profile|quotefast|quickmod|quickmod2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(recent|register|register2|reminder|removepoll|removetopic2|reporttm|requestmembers)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(restoretopic|search|search2|sendtopic|smstats|suggest|spellcheck|splittopics)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(stats|sticky|theme|trackip|about:mozilla|about:unknown|unread|unreadreplies)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(verificationcode|viewprofile|vote|viewquery|viewsmfile|who|\.xml|xmlhttp)/?$ ./index.php?pretty;action=$1 [L,QSA]

# Rules for: boards
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1.$2 [L,QSA]

# Rules for: topics
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1;topic=$2.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ ./index.php?pretty;board=$1;topic=$2.$3 [L,QSA]

The problem is that ss.rsportugal.org/ is correctly redirected and ss.rsportugal.org/forum isn't redirected. Is there anything I can do about this?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I can't sort out exactly what's going wrong here from the configurations (no easy way of telling what rules are getting applied) but maybe I can offer some troubleshooting advice.

  • Simplify. Fewer moving parts make for easier debugging. In particular, have a look at When Not to Rewrite. I'd suggest for example replacing your domain-forwarding rewrite like so:

    Redirect / http://supremeskillers.net/

  • Try setting it up in the main .htaccess without the RewriteBase directive. That one always confuses things.

  • You may be able to simplify your "actions" block using the Redirect directive as well.

  • Try testing one rewrite at a time.

share|improve this answer
    
I was able to fix it by moving the contents of forum/.htaccess to .htaccess, removing the RewriteBase as you told and fixing the rules without the need for Base. Can I use 'Redirect' with .htaccess? (I don't have access to Apache configuration files) –  aLfa Nov 1 '10 at 19:27
    
It depends on your web host. Different hosts allow different directives in .htaccess files, from all to none. If you ask them, they should be able to tell you (or you could just try it, and ask them if it doesn't work.) –  pjmorse Nov 1 '10 at 19:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.