Sign in to follow this  
deavik

[web] Trouble with Apache 1.3 PHP mod_rewrite

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this