|
My web hosting company supports mod_rewrite. I tried using this snippet:
RewriteEngine on
RewriteRule /([a-z0-9_-]*)\.aspx? /main.php?sec=$1 [PT]
so if the request is for "foo.asp" or "foo.aspx", the URL will be rewritten as "main.php?sec=foo". And this works exactly as expected on their server.
I tried to set something similar up on my (Debian -- with Apache 2.0.something, not quite exactly the same as my web host) laptop, putting those lines in a .htaccess file in my public_html directory. But when I ask for "http://localhost/~lucy/foo.asp", it's actually looking for a file named foo.asp, not rewriting it. (I checked, by creating a file called foo.asp.)
I checked my configuration, and both mod_userdir and mod_rewrite are enabled, but it stubbornly refuses to work.
What's wrong?
(NB. I had to email my bit of config snippet to one of the techies at the hosting co. for them to install it. Could they have spootted a mistake and fixed it without telling me?)
Apache modules question?
I'm no web server expert, but I have to ask - what is the exact URL structure that you use to request foo.asp from your hosted web site? Does it include a path from the document root?
I ask because in the example you show for your laptop, you are not requesting from the web server document root, you are requesting from the "~lucy" sub-directory of the web server document root.
|