.htaccess problem need help

  • My server runs cPanel to start with, my website is located at /home/username/public_html and my forums run on an entirely different domain and they run in /home/username/public_html/forums

    So imagine:

    Website: http://domain.com - /home/username/public_html

    Forums: http://domain.community - /home/username/public_html/forums

    I also own multiple other domains a ton, redirecting to the website, so to make it look a ton better I implement a 301 redirect via the .htaccess inside of public_html

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !domain.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
    RewriteCond %{THE_REQUEST} ^(GET|HEAD|POST)\ /index\.php\?nav=([^&\ ]+)&?([^\ ]*)
    RewriteRule ^ /%2/%3 [L,R=301]

    With a rule for pretty url and image redirects.

    IT WORKED GREAT all pages with prettyURL and images upto the 3rd tier redirects to the proper domain.

    When I go visit my forums, it tries to redirect my forum to the new domain, and I am curious why? I know that parent .htaccess sometimes reflects lower level, but HOW do i stop this from happening?


    Tim Düsterhus  Alexander Ebert - I would love a professional opinion

    Edited once, last by kbarg ().

  • I know that parent .htaccess sometimes reflects lower level

    It should read: Always. Apache evaluates all .htaccess files it can find in the requested directory and all direct parents up until the document root!

    but HOW do i stop this from happening?

    Exclude the forum from the rewrite, insert this before the first RewriteRule:

    RewriteRule ^forums($|/) - [L]

    This rule means that whenever the forums directory is requested, it should stop immediately and ignore every rule that comes afterwards.

    Alexander Ebert
    Senior Developer WoltLab® GmbH

  • So my public_html .htaccess is this:

    With it like that my forums are still screwed up.

  • I think i fixed it. When I get home on a proper computer I will post the solution for any other people who *might* have the same problem