Forum Moderators: phranque

Message Too Old, No Replies

Using mod_rewrite Within Virtual Host

on my own machine...

         

garyr_h

7:44 pm on Nov 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have virtual hosts set up on my own machine so I am able to test out several websites at once. The problem is, I can't get mod_rewrite to work within them when it works fine with localhost, but not site1.local.

Regular files work just fine, php, htm, etc. But when trying to use rewrites it just doesn't work. The modules are loaded, but is there something I need to put within the:


<VirtualHost 127.0.0.1>
DocumentRoot "C:\AppServ\My Sites\site1"
ServerName site1.local
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
</VirtualHost>

Which isn't there which is why it isn't working? It just seems odd to me when the files are moved into the localhost directory it works fine, but within the site1.local the rewrite rules just don't work.

The rules are very basic, nothing too complex:


RewriteRule ([^.]+)/([^.]+)\.php$ view-page.php?type=$1&uri=$2
[L,NC]

If anyone can help out, I'd be much thankful.

jdMorgan

1:19 am on Nov 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What mod_rewrite directives do you have within the <virtual_host> container?

For example, did you include RewriteEngine on as specified in the mod_rewrite docs?

Jim

garyr_h

2:00 am on Nov 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have nothing within a <virtual_host>, however within .htaccess I do have RewriteEngine On and also tried RewriteEngine On within the <VirtualHost>

jdMorgan

2:05 am on Nov 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please post your relevant httpd.conf and .htaccess code after removing or obscuring specifically-identifiable information, such as your domain name or uniquely-named pages (see Apache Forum Charter [webmasterworld.com]). We're going to need you to provide a lot more information to be of any help.

Jim

garyr_h

7:12 pm on Nov 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When trying to figure this out I ended up messing up the server (oops...) so I did a clean install using AppServ (which gave me problems with mysql, but found the answer within another thread).

For some reason mod_rewrite works fine now within the virtualhosts. Thanks for responding.