So I need to redirect all non www and non https traffic to https www /forums. I have tried several .htaccess codes and none of them have worked. What is one that will work?
Try the following code. RewriteEngine on RewriteBase / RewriteCond %{REQUEST_URI} !^/forums/ # Rewrites all URLS [Replace "domain" with the actual domain, without the TLD (.com, .net, .biz, etc)] RewriteCond %{HTTP_HOST} ^(www\.)?domain\. # Rewrite all those to insert /folder RewriteRule ^(.*)$ /forums/$1 [L] First check if this works and then we can modify the final request to be https www
It works, but it does not redirect all URLs to be HTTPS. It redirects the main site to be https www, but it does not redirect the http to https if I take out the s in https or the www.
You can use an additional redirect to do that but I don't like the idea of using two redirects as it adds to the load time. I'll ask my server specialist if he can suggest a proper redirect method for this. Will let you know soon.
The redirect you have me didn't work. I was actually using an old redirect I generated in the hosting cpanel as a temporary one. I need to get it fixed.
Try this: RewriteEngine on RewriteCond %{HTTP_HOST} !^$ RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE] Code (markup):
Will that redirect the main domain to /forum? I don't think so. Also will that redirect every URL to HTTPS AND www?
I want to change all http to https, but I also want to change all non www to www. and redirect to /forums.
I played with re-directs in my cPanel and this is the solution it gave me: RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com$ RewriteRule ^/?$ "https\:\/\/www\.yourdomain\.com\/forums\/" [R=301,L] Code (markup):
The beginning it is necessary to explain the possible errors for the entry of visitors to the pages of the site, namely: 400 - Bad Request .. means the wrong application of the page 401 - Authorization Required ... means that he is not licensed for the visitor viewing the page 403 - Forbidden .. means it is forbidden for visitors from entering the page 404 - File not found ... it means that the page that the visitor have requested does not exist 500 - Internal Server Error means that there is an error in the site's server 503 - Service Unavailable ... means that the service is not available These are the common mistakes and there are more other .. To make the error page write in the htaccess file. The following code: ErrorDocument [error number] [path]
So I want to force www and HTTPS on all URLS and I want to redirect the mai domain to /forum. How can I do that using .htaccess?