Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Apache config rewrite rules problem

Hi.
I got a Vanilla Forum fresh installation on a virtual host + subdomain server config.

I made it work and install, I added all rules of Vanilla Forum usual htaccess but it does not work for internal links.
Click on any links here and you get a BAD REQUEST ERROR
http://forum.lesentreprisesdupaysage.fr/

So I must have a rewrite rule problem.

Here are the virtual host server info
DocumentRoot /home/unep/forum/

See here my rewrite rules

    RewriteEngine On

    # Certain hosts may require the following line.
    # If vanilla is in a subfolder then you need to specify it after the /.
    # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
    # RewriteBase /

    RewriteCond %{QUERY_STRING} ^p=/?([^&]+)(&([^?]+))?$
    RewriteRule ^index\.php %1?%3 [E=X_REWRITE:1,L]

    # The basic rewrite rule.
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [QSA,E=X_REWRITE:1,E=X_PATH_INFO:/$1,L]

    # Add the proper X_REWRITE server variable for rewritten requests.
    RewriteCond %{ENV:REDIRECT_X_REWRITE} .+
    RewriteCond %{ENV:REDIRECT_X_PATH_INFO} (.+)
    RewriteRule ^index\.php - [QSA,E=X_REWRITE:1,E=!REDIRECT_X_REWRITE,E=X_PATH_INFO:%1,E=!REDIRECT_X_PATH_INFO,L]

    # 301 redirect urls that start with index.php
    #RewriteCond %{REQUEST_METHOD} GET [NC]
    #RewriteCond %{REQUEST_URI} ^(.*?)/index\.php(.*)$
    #RewriteRule ^index\.php /%1%2 [QSA,R,L]

Thanks for help.

Comments

  • whu606whu606 I'm not a SuperHero; I just like wearing tights... MVP

    @migswd

    Welcome to the community.

    At the top of the htaccess file there is this:

    # If vanilla is in a subfolder then you need to specify it after the /.
    # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
    # RewriteBase /
    

    From your information, you would need to uncomment # RewriteBase / by removing the hash tag, and adding forum after the /

    RewriteBase /forum

  • Hi. Dont think so because I have a subdomain, not a subfolder.
    http://forum.lesentreprisesdupaysage.fr/

Sign In or Register to comment.