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.

htacces.dit or htaccess?

hello, I am with a problem of much redirection.
In my original server, I have allready a htaccess file in my root and decompress vanilla264 I have a htaccess.dist file.
I have two files that are next to each other.
Besides, I have trouble configuring the https redirection.
Question to make htaccess files and htaccess.dist?
How to configure https redirection?
Thanks for your help.

Comments

  • The .dist file is the one that comes with the package. I've always had to edit these to be honest in my environment. I believe they are environmentally specific. The idea however is just to rename that file to .htaccess. However, you may have to compare the two and cherry pick.

    Regarding https redirection... google is your friend. ;-)

  • @donovanb a dit :
    The .dist file is the one that comes with the package. I've always had to edit these to be honest in my environment. I believe they are environmentally specific. The idea however is just to rename that file to .htaccess. However, you may have to compare the two and cherry pick.

    Regarding https redirection... google is your friend. ;-)

    Thank you for your answer, I have an original file of the server htaccess. I'll have to erase it.
    htaccess.dist that comes from the package.Did i to rename it?
    htaccess.dist rename to htaccess?
    thank
    Best regards

  • rename to ".htaccess" (with the dot)

  • If you already have an existing .htaccess file keep that and don't care about that htaccess.dist

  • @R_J a dit :
    If you already have an existing .htaccess file keep that and don't care about that htaccess.dist

    thank you very much for your answer so the htaccess.dist do not matter too much?
    If I ask this question. It's just for a security issue.
    The htaccess server, I called my provider who told me that I can erase his htaccess.
    So if you had the choice. Would you prefer the modified htaccess.dist in htaccess vanilla package?
    Thank you for helping a beginner like me
    best regards

  • You may have to create a .htaccess file from both files. You could post the contents of the original (non .dist) file here between ``` characters here if you'd like us to help decide.

  • @donovanb a dit :
    You may have to create a .htaccess file from both files. You could post the contents of the original (non .dist) file here between ``` characters here if you'd like us to help decide.

    hello, I think for a security reason. I will keep the original vanilla htaccess file. My provider told me that there was a file standar way in the server, that I can erase the file.

    So I will transform the htaccess.dist racine file to >> htaccess
    Best regards

  • AldebaronAldebaron New
    edited December 2018

    @Aldebaron a dit :

    @donovanb a dit :
    You may have to create a .htaccess file from both files. You could post the contents of the original (non .dist) file here between ``` characters here if you'd like us to help decide.

    hello, I think for a security reason. I will keep the original vanilla htaccess file. My provider told me that there was a file standar way in the server, that I can erase the file.

    So I will transform the htaccess.dist racine file to >> htaccess
    Best regards

    Original

    If you modify this file then change the above line to: # Modified


    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 /
    
    # Make sure that / doesn't try to go to index.php without a rewrite :)
    DirectoryIndex disabled
    
    ####
    # Deny access to certain directories that SHOULD NOT be exposed.
    ####
    RewriteRule (^|/)\.git - [L,R=403]
    RewriteRule ^cache/ - [L,R=403]
    RewriteRule ^cgi-bin/ - [L,R=403]
    RewriteRule ^uploads/import/ - [L,R=403]
    RewriteRule ^vendor/ - [L,R=403]
    
    ####
    # Prevent access to any php script by redirecting the request to /index.php
    # You can add an exception by adding another RewriteCond after this one.
    # Example: RewriteCond %{REQUEST_URI} !^/yourscriptname.php$
    # You can comment out this section if it causes you problems.
    # This is just a nice to have for security purposes.
    ####
    RewriteCond %{REQUEST_URI} !/index.php$
    RewriteRule (.+\.php) [E=X_REWRITE:1,E=X_PATH_INFO:/$1,L]
    
    ####
    # Redirect any non existing file/directory to /index.php
    ####
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule (.*) index.php [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 - [E=X_REWRITE:1,E=!REDIRECT_X_REWRITE,E=X_PATH_INFO:%1,E=!REDIRECT_X_PATH_INFO,L]
    



    Header set Cache-Control "max-age=315360000"
    Header set Expires "31 December 2037 23:59:59 GMT"

Sign In or Register to comment.