I'm attempting to get this module working running Apache 2.4.7. After much testing, I cannot get the incoming requests to redirect to js.php
. Once the module is enabled, the .htaccess
file lines added, and the js.php
file moved into place, the only immediate effect I see is that calls to /js/foo/bar
are still routed through index.php
. The page callback is still executed, but a 404 is returned.
I'm attaching a mod rewrite log output, and will post back here if I come across a fix.
This is the code, placed immediately in front of core's index.php
rewrite rule (although I've tried it virtually everywhere).
# Rewrite JavaScript callback URLs of the form js.php?q=x.
RewriteCond %{REQUEST_URI} ^\/([a-z]{2}\/)?js\/.*
RewriteRule ^(.*)$ js.php?q=$1 [L,QSA]
RewriteCond %{QUERY_STRING} (^|&)q=((\/)?[a-z]{2})?(\/)?js\/.*
RewriteRule .* js.php [L]
Comments
Comment #1
webevt CreditAttribution: webevt commentedHi
It seems Apache automatically calls js.php for requests like /js/*. This happens because of MultiViews option that is enabled by default. You should add this line to your .htaccess in order to disable the multiviews feature and make requests work properly:
Options -MultiViews
Regards
Comment #2
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedhow can I test the fix?
Comment #3
heylookalive CreditAttribution: heylookalive commented+1 for me, this sorted the redirect now working.
Comment #4
Erik FrèrejeanThe "Multiviews" option indeed resolves this issue. Small side note though, this problem only exists when you're not using a localised callback. IE
/nl/js/foo
is routed correctly with the default .htaccess.Comment #5
markhalliwellThis isn't an issue with this project, but more so with the server config (which can vary, widely). This project is only meant to provide a general "guide" on how to setup these rewrite "rules", nothing more.