yandoo Posted January 14, 2013 Share Posted January 14, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/273163-htaccess-works-fine-on-web-server-but-not-on-wamp/ Share on other sites More sharing options...
requinix Posted January 14, 2013 Share Posted January 14, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/273163-htaccess-works-fine-on-web-server-but-not-on-wamp/#findComment-1405708 Share on other sites More sharing options...
yandoo Posted January 14, 2013 Author Share Posted January 14, 2013 (edited) 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 January 14, 2013 by yandoo Quote Link to comment https://forums.phpfreaks.com/topic/273163-htaccess-works-fine-on-web-server-but-not-on-wamp/#findComment-1405710 Share on other sites More sharing options...
requinix Posted January 14, 2013 Share Posted January 14, 2013 Ive tried entering random words to the htaccess file and i dont get a 500 error either.. Then the .htaccess isn't being parsed. You sure you found the right AllowOverride? The vhost definition might have one of its own. Quote Link to comment https://forums.phpfreaks.com/topic/273163-htaccess-works-fine-on-web-server-but-not-on-wamp/#findComment-1405725 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.