On my personal site I use the following .htaccess file and it works, but now I'm using it for a business site (microtekusa.com) <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.microtekusa\.com [NC] RewriteRule ^(.*) http://www.microtekusa.com/$1 [L,R=301] </IfModule> But I'm trying to get one of our companies sites to do this as well, but dropping this in the public_html folder for our site has no success. When I create it and drop it in nothing changes, its as if nothing occurs. Am I doing something wrong, or is htaccess just not turned on in Apache? I'm in Marketing and its possible IT didn't enable this. Anything other than that that I could be overlooking? Thanks!
er, what are you trying to do? It looks like...nothing! Looks like you're redirecting from www. to www. aka...no change.
RewriteEngine on RewriteCond %{HTTP_HOST} ^microtekusa\.com [NC] RewriteRule ^(.*)$ http://www.microtekusa.com/$1 [R=301,L] Notice your RewriteCond line has the www. aka...says you must be at www.domain.com to work!
Says we have: Server Type: Apache/1.3.33 (Unix) mod_ssl/2.8.22 OpenSSL/0.9.7e I am determining if mod rewrite is enabled as well as htaccess, but just wanted to make sure that would be the only other thing Thanks for the help
I think mod_rewrite is the only thing you need for your .htaccess file to work but Nintendo is much more experienced in this if he wants to chime in. Just make sure it's turned on. I had the same problem with a server hosted by another company. Once they turned it on the same rewrite rules you have worked just fine. Good luck.
Try this test, with index.html being the filename of the real index file. Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^wacko\.html$ index.html [L] domain.com/wacko.html should show the index page if you got mod_rewrite. LOL! I've posted twice!! It's the avatar that makes it hard to notice who's making da post!!!!
Yeah, nothing is coming up under wacko.html for that domain so it looks like I need to have mod_rewrite enabled. Thanks!
Here is what I got back from our IT guys: mod_rewrite is now enabled on Apache on both servers: http://support.microtek.com/test.phtml Does that look correct on the settings? I uploaded the .htaccess file again and still no change Thanks!
Try this code and see if it works. If not, post again and we'll try to figure something out. <IfModule mod_rewrite.c> Options +Indexes Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.microtekusa\.com [NC] RewriteRule ^(.*) http://www.microtekusa.com/$1 [R=301,L] </IfModule>
Hmm, doesn't work On the link I posted above it supposedly has all our server settings Is something in there setup incorrectly or not turned on?
Things seem okay but there is no way to be sure that it's not turned off in the config file. You'll need to ask your server host if they enabled mod_rewrite rather than just installing it. It can be installed but turned off on the main configuration file which will keep it from working on the whole server. The code I gave you works on about 10 sites I have it on so it should work. Try asking the host first. If they say it's turned on and working, give them the .htaccess code you're trying to use. Sometimes the rewrite rules are different on some servers. Their tech guys should be able to tell you right away.
If http://forums.digitalpoint.com/showpost.php?p=1863877&postcount=4 and http://forums.digitalpoint.com/showpost.php?p=1876290&postcount=8 don't work, then your server is still messed up. Or try them with out Options +Indexes Options +FollowSymlinks