6
votes

the module in the httpd.conf for rewrite is as follow:

LoadModule rewrite_module modules/mod_rewrite.so

path to .htaccess:

c:\wamp\www\magentodev\.htaccess

therefore in .htacess I have this:

<IfModule mod_rewrite.so>

    Options +FollowSymLinks
    RewriteEngine on

    RewriteCond %{REQUEST_URI} ^/boombottleh2o\+?$
    RewriteRule (.*) /gu/boombottleh2o.php [NC,L,QSA]

//some other ones

</IfModule>

I expected to try:

localhost/magentodev/boombottleh2o

instead of:

localhost/magentodev/gu/boombottleh2o.php

it supposed to work because it is working on production but not localhost, I have wamp server apache and here is some configurations:

in C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf:

<Directory "c:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require local
</Directory>

it is not correct as Anu is saying so I am changed the in C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf to:

<Directory "C:/wamp/www/">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>

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

I could not figure out what is wrong, I appreciate any help

3
RewriteBase /gu/ maybe?Darren
I don't think that's the case I think it is some configuration as I said I don't have any problem in production it works fine, I also tried your suggestion and didn't workNickool
As others have alluded to in answers, the RewriteCond does not match your input URL which makes the entire thing dead code.covener
@covener the same works on productionNickool

3 Answers

5
votes

Have your C:/wamp/www/magentodev/.htaccess like this:

ErrorDocument 404 default
Options +FollowSymLinks
RewriteEngine on

RewriteRule ^boombottleh2o(/.*)?$ gu/boombottleh2o.php [NC,L]

mod_rewrite References:

2
votes

I had a similar problem on my Wamp server ver 2.5 with Windows 7..

Your .htaccess file looks solid for what you're trying to accomplish, but with your vhost.conf make sure to cover all your boundaries and add a regex * at the beginning of the file

So instead of

< VirtualHost localhost:80>
You get
< VirtualHost *:80>

This eliminates localhost as you already set that as the ServerName and You can add an alias under neath

This may sound obvious but have you tried anything with the wampmanager?

Click on the Wamp Icon, then Apache, then modules and scroll down a bit and make sure the rewrite module has a check next to it. That fixed it for me!

Good Luck, Wamp is always trickier than it seems

1
votes

It looks like your RewriteCond expects to match http://localhost/boombottleh2o/ rather than the url you used localhost/magentodev/boombottleh2o as the REQUEST_URI string will contain /magentodev/boombottleh2o, but your regex expects to match /boombottleh2o at the very beginning of the string.

To fix the condition, you should need to remove the carat ^ at the beginning.

You're also escaping the + character towards the end of your regex. \+? will try to match the + symbol 0 or one times. I'm not sure if that was intentional, but if you use .*? instead you'll always match a request for the /boombottleh20/ folder, even if the request goes deeper or includes a file type

Tl;dr - I think your RewriteRule should look like this:

RewriteCond %{REQUEST_URI} /boombottleh2o.*?$