I am trying to redirect all non www urls to www urls. I am using xenforo. This is what I put in my .htaccess file and it isn't working RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Code (ApacheConf):
#Force www: RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC] Try adding the url. At a glance it seems to me your code should probably work though. N.
That is odd. i would probably have to crawl in there. Are you sure mod_rewrite is actually on? I gather it is or it would throw an error when you add that. Did you remember to turn on friendly urls as well. Depending on how the server is setup php info file may point to an issue as well. https://mediatemple.net/community/products/dv/204643880/how-can-i-create-a-phpinfo.php-page
Ahh it could very well be the case that htacces is not enabled in Nginx. You are not serving stuff with apache. HTTP/1.1 200 OK => Server => nginx You would need to be able to take a look at nginx.conf I don't think you can just drop one in the root folder like .htaccess. You will probably have to ping your host on this one if you don't have root access. Here is a pretty handy tool to convert that rule if need be. http://winginx.com/en/htaccess hope that helps a bit, Nigel
The web host said I had to enable it in .htaccess and i did that. The .htaccess file came with xenforo and i renamed it from .txt and it works with freindly URLs. The freindly URLs didn't work before I renamed the .htaccess. The host says to use .htaccess.
Here it is: # Mod_security can interfere with uploading of content such as attachments. If you # cannot attach files, remove the "#" from the lines below. #<IfModule mod_security.c> # SecFilterEngine Off # SecFilterScanPOST Off #</IfModule> ErrorDocument 401 default ErrorDocument 403 default ErrorDocument 404 default ErrorDocument 405 default ErrorDocument 406 default ErrorDocument 500 default ErrorDocument 501 default ErrorDocument 503 default <IfModule mod_rewrite.c> RewriteEngine On # If you are having problems with the rewrite rules, remove the "#" from the # line that begins "RewriteBase" below. You will also have to change the path # of the rewrite to reflect the path to your XenForo installation. #RewriteBase /xenforo # This line may be needed to enable WebDAV editing with PHP as a CGI. #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L] RewriteRule ^.*$ index.php [NC,L] </IfModule> #Force www: RewriteEngine on RewriteCond %{HTTP_HOST} ^utahfishkeepers.us [NC] RewriteRule ^(.*)$ http://www.utahfishkeepers.us/$1 [L,R=301,NC] Code (ApacheConf):
Try sticking this on line 19 instead RewriteCond %{HTTP_HOST} ^utahfishkeepers.us [NC] RewriteRule ^(.*)$ http://www.utahfishkeepers.us/$1 [L,R=301,NC] and delete it from the bottom. you are invoking rewrite engine on twice. Not sure what the implications of that are but you likely want that rule higher before it starts trying to parse other stuff as well. Also change this #RewriteBase /xenforo to this RewriteBase / if it doesn't work.