views:

186

answers:

2

Hello guys!

I'm developing a website on localhost using XAMPP under Windows 7. The website URL is http://localhost/lyrics. How can I enable url rewriting for that subdirectory?

I tried with the code below but it didn't work.

RewriteEngine On
RewriteBase /lyrics

Thanks in advance.

A: 

First of all, welcome to SO!!

Make zure mod_rewrite is enabled in httpd.conf and add à slash after lyrics:

RewriteBase /lyrics/
Time Machine
I also tried with the ending slash but it didn't work either. The module is enabled and rewriting works fine for http://localhost/
Psyche
What about placin another htacces in /lyrics/ Also: does the lyrics directory exists?
Time Machine
A: 

Wait - so you're doing this in development and production mode, and it only works in development ( localhost ) ?

Are you relying on virtualhosts or strictly .htaccess? Can you confirm that even a simple basic .htaccess rule like ErrorDocument works in production mode?

Any reason you can't just make a VirtualHost for that directory?

<VirtualHost *:80>
ServerName foo.localhost.com  # this needs to be in your hosts file as 127.0.0.1 foo.localhost.com
DocumentRoot C:/whatever/lyrics

* add your rewrite rules here *
</VirtualHost>
meder
So, if I try the same rewriting rules under http://localhost (no subdirectory), it works just fine. But if I move all the code in http://localhost/lyrics/ it doesn't work anymore.I will try with a virtual host. Thanks.
Psyche