Jump to content

htaccess works fine on web server but not on Wamp


yandoo

Recommended Posts

I'm using htaccess to remove the extensions - .html and .php on my web server online and it works fine. However it doesnt work at all when trying to set it up on wamp.

Heres whats ive done:

 

In Wamp - enabled Apache modules Rewrite

Ensured there is no # comment in httpd.config line: LoadModule rewrite_module modules/mod_rewrite.so

Created htaccess from notepad in directory: wamp\www\vitalbodyhealth

Used same code that works online web server:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

 

I've been searching forums and someone said that because it is a sub directory i.e. wamp\www\vitalbodyhealth as opposed to wamp\www\ there could be a problem and that adding: RewriteBase /vitalbodyhealth

before the RewiteRules would fix it. I've tried it and it doesnt work either way. I just get a 404 error.

 

I don't understand why its not working... Any ideas?

 

Thanks :)

Link to comment
Share on other sites

The stuff you have there is completely path-agnostic.

 

Are you sure your WAMP setup allows for .htaccess files? It may have a AllowOverride directive which tells Apache to ignore .htaccess files. Easiest way to check for this is to put random nonsense in the .htaccess and see if you get a 500 error browsing the site.

Link to comment
Share on other sites

I have made sure it says AllowOverride ALL in http.confg.

 

If i got to http://localhost/vitalbodyhealth/

 

it works the index.php is hidden... but if i got to http://localhost/vitalbodyhealth/blog not using the .html extension is just says 404 not found - The requested URL /vitalbodyhealth/blog was not found on this server.

 

Ive tried entering random words to the htaccess file and i dont get a 500 error either..

Edited by yandoo
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.