3 Replies - 959 Views - Last Post: 05 August 2011 - 05:35 PM

#1 aaron1178  Icon User is offline

  • Dovakiin, Dragonborn
  • member icon

Reputation: 169
  • View blog
  • Posts: 1,297
  • Joined: 22-October 08

Cannot use .htaccess to rewrite php files

Posted 05 August 2011 - 09:28 AM

Hey all,
As some know, I've just installed AMP (Apache + MySQL + Php) + PhpMyAdmin. Now I've set up a Virtual host and it works fine, except for the .htaccess file in the directory. I've made sure mod_rewrite is on and everything. It's not giving a 500 internal error which means its working. But when I type http://dev/Home it will not do what its supposed to.

.htaccess
RewriteEngine on

RewriteRule ^Home$ index.php
RewriteRule ^Home/$ index.php
#^^Does not include styles DONOT USE



httpd-vhosts.conf
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
<Directory C:/Server/virtual>
  Order Deny,Allow
  Allow from all
</Directory>
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

<VirtualHost *:80>
  DocumentRoot C:/Server/www
  ServerName localhost
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot C:/Server/Virtual/DarkRisingStudios
  ServerName dev
</VirtualHost>



it is working perfectly, except for mod_rewrite.

I know this is more of a Server Question, but php people know what they are talking about through experience.

Thanks,

Is This A Good Question/Topic? 0
  • +

Replies To: Cannot use .htaccess to rewrite php files

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1002
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: Cannot use .htaccess to rewrite php files

Posted 05 August 2011 - 09:43 AM

Quote

It's not giving a 500 internal error which means its working.


That's not true. Does anything in your .htaccess work?

Try adding AllowOverride All to your vhost definitions.
Was This Post Helpful? 1
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,436
  • Joined: 23-August 08

Re: Cannot use .htaccess to rewrite php files

Posted 05 August 2011 - 10:26 AM

If you KNOW it's not a PHP question, then DON'T ASK IT IN PHP!!!

Moved to Web Servers & Hosting.
Was This Post Helpful? 1
  • +
  • -

#4 aaron1178  Icon User is offline

  • Dovakiin, Dragonborn
  • member icon

Reputation: 169
  • View blog
  • Posts: 1,297
  • Joined: 22-October 08

Re: Cannot use .htaccess to rewrite php files

Posted 05 August 2011 - 05:35 PM

This worked :) +1
Although I am not familiar with the Apache syntax I tried
  <Directory C:/Server/Virtual/File>

  AllowOverride All

 </Directory>



but through trial and error put
  <Directory />

  AllowOverride All

 </Directory>



and now mod_rewrite is working :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1