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]
CommentFileSizeAuthor
debug.txt20.69 KBjhedstrom
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webevt’s picture

Hi

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

SocialNicheGuru’s picture

how can I test the fix?

heylookalive’s picture

+1 for me, this sorted the redirect now working.

Erik Frèrejean’s picture

The "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.

markhalliwell’s picture

Status: Active » Closed (won't fix)

This 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.