1

I have WAMP v2.2 installed on my Windows 7 machine, with virtual hosts enabled.

I've successfully installed ExpressionEngine for one of my local sites, and everything works great except when I try to remove index.php from the URL using the approved .htaccess method. I still get a 404 error if index.php is not present, but the page displays fine with index.php in the URL.

I made sure the rewrite module was checked in the Apache menu:
the rewrite module was checked in the Apache menu. I've successfully used this method dozens of times on commercial hosts, so I'm stumped.

Update for pvledoux:

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Removes index.php
  RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php/$1 [L]

  # If 404s, "No Input File" or every URL returns the same thing
  # make it /index.php?/$1 above (add the question mark)
</IfModule>

Note: I tried adding the ? into the rule, but it didn't work.

The site is at the root of the Virtual Host.

double-beep
  • 5,031
  • 17
  • 33
  • 41
kmgdev
  • 2,607
  • 28
  • 41
  • Can you show us the code of your .htaccess? Is the site installed in a sub-folder? – pvledoux Jun 07 '12 at 19:21
  • Maybe `RewriteBase /` as suggested here: http://stackoverflow.com/questions/7084223/codeigniter-removing-index-php-in-url-on-wamp ? –  Jul 05 '12 at 17:21

5 Answers5

2

Got It!

I needed to add AllowOverride in httpd-vhosts.conf:

<Directory "C:\Site\Root\Path">
    AllowOverride All
    Order Deny,Allow  
    Allow from all
</Directory>

A gagillion thanks and a 6-pack of beer goes to @parhamr for helping me out of this pickle.

kmgdev
  • 2,607
  • 28
  • 41
1

try to add RewriteBase /

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase / 

  # Removes index.php
  RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php/$1 [L]

  # If 404s, "No Input File" or every URL returns the same thing
  # make it /index.php?/$1 above (add the question mark)
</IfModule>

and check for sure that mod_rewrite is active in phpinfo

Max Lazar
  • 11
  • 2
1

A few possibilities here you could try out here:

[...]
RewriteEngine On
Options FollowSymLinks
[...]

Or:

[...]
RewriteEngine On
Options +MultiViews
[...]

Or:

[...]
RewriteEngine On
Options FollowSymLinks
Options +MultiViews
[...]

From my experience, Apache when running on Windows often needs one or both of those in order to do these kinds of things correctly. It might also straight up 500 on you, but these have worked for me in the past.

Evan Rowe
  • 103
  • 5
0

Have you checked your default document in Apache? If you are removing index.php physically from the machine and it reports a 404 on just a directory, www.domain.com/home/ that means Apache is looking for index.php still.

Josh
  • 10,352
  • 12
  • 58
  • 109
  • Hi Josh, Are you saying I should remove index.php as the default document? I tried it and it had no effect. I also tried just commenting out the whole command but that didn't work either. – kmgdev Jun 07 '12 at 19:35
  • @kgrote Where are you setting the default document in Apache? If you show what you are defaulting in Apache, we should be able to detect what the problem is. – Josh Jun 07 '12 at 19:39
  • Here's what the rule looked like by default: ` DirectoryIndex index.php index.php3 index.html index.htm ` And after I updated it: ` DirectoryIndex index.php3 index.html index.htm ` The file is located in `C:/wamp/bin/apache/Apachex.xx.x/conf/httpd.conf` – kmgdev Jun 07 '12 at 19:41
  • @kgrote And you are sure the dir_module is installed? – Josh Jun 07 '12 at 19:54
0

Is mod_rewrite turned on in the Apache?

DaveShaw
  • 52,123
  • 16
  • 112
  • 141