Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.htaccess example for subfolders doesn't seem right #127

Open
Arantor opened this issue Mar 24, 2018 · 0 comments
Open

.htaccess example for subfolders doesn't seem right #127

Arantor opened this issue Mar 24, 2018 · 0 comments

Comments

@Arantor
Copy link

Arantor commented Mar 24, 2018

In the readme there is an example for using this in a subfolder - but I'm not entirely sure it routes correctly with RewriteBase / and then rewriting at the folder level.

I ended up creating an .htaccess file that lives in /moodle34/ as follows:

   # Enable RewriteEngine
   RewriteEngine on
   # All relative URLs are based from root
   RewriteBase /moodle34/
   # Do not change URLs that point to an existing file.
   RewriteCond %{REQUEST_FILENAME} !-f
   # Do not change URLs that point to an existing directory.
   RewriteCond %{REQUEST_FILENAME} !-d

   # Rewrite URLs matching ^(.*)$ as $1 - this means all URLs.
   # Rewrite it to the cleanurls router
   # Use ?q=$1 to forward the original URL as a query parameter
   # Use the flags:
   # - L (do not continue rewriting)
   # - B (encode back the parameters)
   # - QSA (append the original query string parameters)
   RewriteRule ^(.*)$ local/cleanurls/router.php?q=$1 [L,B,QSA,END]

This seems to solve the issue, without having the rewrite scope being weird... I don't think I've missed anything but would be interested to know if there's a difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant