[web] Trouble with Apache 1.3 PHP mod_rewrite

Started by
2 comments, last by Sander 17 years, 9 months ago
Hello! I used mod_rewrite to get "Pretty URLs" for my website. I got it working then, but I haven't really grasped its innards and I'm having trouble now. First, here's my .htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([a-z/]+)$ content.php?module=$1
RewriteRule ^([a-z/]+),([0-9a-zA-Z_\-]+)$ content.php?module=$1&id=$2
Its really simple, if there are [a-z/] after the domain name, put the relative path as a module ($_GET) to content.php. You will have noticed that if the path contains -, ~ etc characters it won'y rewrite the URL. I have been using mydomain.com/some-thing for storing files for a long time. Recently I created a mydomain.com/~name subdirectory for my mother so that she can have her own website. The thing is, trying to access PHP files such as mydomain.com/~name/page.php gives a "500 Internal Server Error". I'm guessing mod_rewrite is messing things up. Note: HTML pages such as mydomain.com/~name/page.html don't give an error, it's only files ending with .php. But this means I can't run PHP scripts from that directory :(. Sorry for the long post, I would be really grateful for any help! [smile]
Advertisement
Hmmm, renaming mydomain.com/~name/page.php to mydomain.com/some-name/page.php makes it work! It wasn't mod_rewrite's fault after all! :)

I guess there's some mystery with the tilde that doesn't elt PHP scripts run, or something.
We can only possibly help you if you post:

a) The entire Apache master config
b) The .htaccess file (as above)
c) Relevant lines from the Apache error log.

If you do not have access to all of these things because you're on shared hosting, good luck trying to do anything at all useful. You'll need it.

Mark
Quote:a) The entire Apache master config


Not needed. Most are pretty alike.

<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>

This topic is closed to new replies.

Advertisement