HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Need some assistance with .htaccess so a calendar installation in a subfolder can be accessed

Good day,

I'm having an issue with editing the .htaccess that is in the public_html that vanilla uses. I have setup Vanilla 3 for out local homeschool group. We are using a php calendar that is installed in the subdirectory calendar. How can I add to the .htaccess so it will allow access to that subfolder?

below is the htaccess from the vanilla install. Im not sure what to add.

Thanks in advance for any suggestions.

# Original

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


<IfModule mod_rewrite.c>

  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]

</IfModule>


<IfModule mod_headers.c>

  <FilesMatch "(?<!embed)\.(css|js|woff|ttf|eot|svg|png|gif|jpeg|jpg|ico|swf)$">

   Header set Cache-Control "max-age=315360000"

   Header set Expires "31 December 2037 23:59:59 GMT"

  </FilesMatch>

</IfModule>


# php -- BEGIN cPanel-generated handler, do not edit

# Set the “ea-php71” package as the default “PHP” programming language.

<IfModule mime_module>

 AddHandler application/x-httpd-ea-php71 .php .php7 .phtml

</IfModule>

# php -- END cPanel-generated handler, do not edit

Comments

  • BleistivtBleistivt Moderator

    The instructions for this are already in the .htaccess file. See this section:

    # 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]
    

    If your calendar script is also accessed through a single PHP file, you could add a condition like this (above the RewriteRule):

    RewriteCond %{REQUEST_URI} !^/calendar/index.php$
    

    Otherwise, just comment out the last two lines in said section (add a # before each line).

    R_J
Sign In or Register to comment.