Asked  7 Months ago    Answers:  5   Viewed   28 times

I have two main problems with mod_rewrite:

  1. There is no meaningful error reported when I have an invalid rule

    Enter image description here

  2. To reliably test each modification, I have to erase Google Chrome's cache. This isn't rocket science, but I have to hit Ctrl + Shift + Delete, click OK, and close the window, and reload.

I'd like to see if any of the gurus are willing to share their secrets to efficiently managing mod_rewrite code.



One trick is to turn on the rewrite log. To turn it on, try this line in your Apache HTTP Server main configuration or current virtual host file (not in .htaccess):

LogLevel alert rewrite:trace6

Before Apache httpd 2.4 mod_rewrite, such a per-module logging configuration did not exist yet. Instead you could use the following logging settings:

RewriteEngine On
RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 3
Tuesday, June 1, 2021
answered 7 Months ago

I've found a solution:

RewriteEngine on
RewriteBase /mysite/

RewriteRule ^css/css.css css/css.php [L]
RewriteRule ^css/(.*)$ css/$1 [L]
RewriteRule ^js/js.js js/js.php [L]
RewriteRule ^js/(.*)$ js/$1 [L]
RewriteRule ^img/(.*)$ img/$1 [L]
RewriteRule ^(.*)$ index.php?rewrite=$1 

It works fine, but I don't know why it's necessary

RewriteRule ^css/(.*)$ css/$1 [L]


RewriteRule ^js/(.*)$ js/$1 [L]

I hope it hepls anyone.

Thanks! :)

Friday, May 28, 2021
answered 7 Months ago

I doubt the magic cookie trick, also known as the shebang, would work on Windows. This is a UNIX/Linux feature.

You'll have to specify the PHP interpreter and the script as its argument (see also

RewriteMap router "prg:C:/Program Files/PHP5.3.2/php-win.exe C:/dev/web/www/routing.php"

If that doesn't work, it might be because of the space in Program Files. Windows supports a short name in such cases. For example PROGRA~1 is a typical short name, but the digit in the name is assigned on a first-come first served basis, so you should double-check with the DIR command.

Or else you could move your php-win.exe executable to a directory that doesn't contain spaces.

If it isn't totally clear already, I'll say this: Windows sucks.

Saturday, May 29, 2021
answered 7 Months ago

If you want to remote debug, you need to enable debugging in worker JVMs. See here for the correct Java flags: Remote debugging a Java application

Add this flags in all/shared supervisor storm.yaml to entry worker.childopts (it might be necessary to restart Storm cluster). You need to make sure, that only a single worker is stared per host! Otherwise, two JVMs want to open the same port and one will fail of course.

In Eclipse, choose Run -> Debug Configuration and create a new Remote Java Application. Specify the host and port (port must be the same as specified in worker.childopts) of the running worker JVM you want to debug.

Wednesday, August 4, 2021
answered 4 Months ago

If you run in local mode, there is no worker JVM involved, ie, no worker process is stared. Thus, your worker.childopts settings do not have any effect.

The easiest way to debug within Eclipse it to submit/start the topology within Eclipse instead of command line. Your class CrawlTopology has a main method, thus you can just execute it directly in Eclipse (of course in debug mode). You don't need to specify a jar file name. Just specify your options -conf crawler-conf.yaml -local in your Eclipse run configuration.

Friday, August 20, 2021
answered 4 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :