Hi all,

I'm sure that I'm going to ask for something easy and probably silly, but I need you help.

I have followed the steps from the readme.txt:

  1. module js is installed and enabled
  2. js.php is moved to the root directory (same than .htaccess)
  3. next code is added to the .htaccess
  4. # Rewrite JavaScript callback URLs of the form 'js.php?q=x'.
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} ^\/js\/.*
        RewriteRule ^(.*)$ js.php?q=$1 [L,QSA]

Now I'm watching the http requests and I really don't know if the module is working or not. I'm checking the js requests but I don't appreciate any difference.

Could you tell me how to know whether the module is working or not.

Thanks
Javier

Comments

michielnugter’s picture

Hi,

There is a very simple way of checking that the js callback works. You can debug this using a debugger or using a more basic approach:

Place the following as the first line of code in the js.php file:

echo "test"; exit;

If it doesn't echo test and exit, you're not running on js.php yet.

javier.drupal.2012’s picture

Hi,

I tried your code adding the line echo "test"; exit; to the js.php. However, my application is not showing test.

Is there any way to know what is the matter to solve the problem?

If it is useful for you, when I access to the configuration of the js module in admin/config/development/performance, there is not any new field referencing the js module configuration. See a picture attached.

The status report is fine and it is not showing any error for js module.

Thanks heaps
Javier

javier.drupal.2012’s picture

Hi,

I don't know why but js.php is not being called at all. Anyway, If I manually call the path localhost:8082/js.php?q=url, I got a 403 for the js.php file

Any advise about this issue?

Thanks

michielnugter’s picture

Hi Javier,

Did you also try the echo "test"; die(); when calling the js.php file directly?

If you provide access arguments or an access callback it checks the those and if they fail the js.php will trigger a 403 warning. Another 403 warning can be that the module in the path cannot be found.

If it's none of these things I guess it must be your server configuration, that part I'm not that good at unfortunately.

Let me know if/when you figured out the problem.

michielnugter’s picture

Status: Active » Closed (cannot reproduce)

Closing this issue as there hasn't been any activity in the last month anymore. Please let me know if you need more help.

BTW, I just reread some of your comments. I seems that the js module is just not enabled or your cache is incorrect, it really should have a configuration page. Maybe if you try the latest dev version you'll have more luck.

javier.drupal.2012’s picture

Issue summary: View changes
Status: Closed (cannot reproduce) » Active

Hi again,

I have had the chance to try again this module. I am having the same issue. However, when I write the echo "test"; exit; in the js.php file, the js/shs/json query answering test.

This makes me think that js.php is enabled and the redirection is ok.

Js files are working fine, however, the shs module query (/js/shs/json) is responding an empty fileld, therefore, the shs module is not showing the results and the js script is failing with a "TypeError: data is null" in the line

if (data.success == true) {

Could you help me with this issue?

The redirection rules that I have in the .htaccess is

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

My server is a LiteSpeed one.

If you need more info let me know.

Thanks heaps!
Javier

SKAUGHT’s picture

insert above drupals 'normal' RewriteCond

 .....
# RewriteBase /

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]

# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
....
markhalliwell’s picture

Status: Active » Closed (works as designed)

I know this works on the 7.x-1.x branch as well as the 7.x-2.x. Unfortunately I do not have the time to debug this. This question is more appropriate for http://drupal.stackexchange.com

chriscalip’s picture

This solved this for me, quote:

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

ArtuDrop’s picture

#9 is the great solution for me.
Thank you.