Apache: Redirect http to https Apache secure connection – force HTTPS Connections

by on November 26, 2006 · 80 comments· LAST UPDATED May 18, 2007

in , ,

Let us say you have webmail sub-domain called http://mail.nixcraft.com and you would like to redirect it to https secure connection i.e. https://mail.nixcraft.com.

This will help you protect user privacy and sensitive information such as username and password remotely.

So how do you configure your Apache web server so that you prevent your web sites from being accessed without encryption?

Redirect http to https Apache Configuration

First make sure Apache is configured for HTTPS connection and necessary SSL certificates are installed.

No non-ssl access i.e. only accept https connections

Now open httpd.conf or .htaccess file (mod_rewrite not required):
# vi httpd.conf
Append following line :
Redirect permanent / https://mail.nixcraft.com/
Any request made to http://mail.nixcraft.com will goto https://mail.nixcraft.com/

Save and close the file. Restart the Apache:
# /etc/init.d/httpd restart

This is easiest way to ensure that your normal user never use plain text HTTP protocol to send data. Now this makes it much harder to sniff sensitive data.

Force webmail login over SSL https session

So if you want force users to access their webmail through https, add following configuration to .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Make sure you have something as follows in httpd.conf (mod_rewrite support):
LoadModule rewrite_module modules/mod_rewrite.so

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 80 comments… read them below or add one }

1 Naresh February 23, 2007 at 5:06 pm


We have an urls like http://mydomain.com. We need this url to secure. That is this url need to be change https://mydomain.com

Please let me know in case of any concerns.



2 nixCraft February 23, 2007 at 5:08 pm

Add line as follows and restart httpd:
Redirect permanent / https://mydomain.com


3 mohit September 10, 2013 at 6:30 am



4 Prachi February 27, 2007 at 5:01 am


we need to redirect:
http://mydoamain.com/books to

kindly suggest for the same


5 Juan August 5, 2013 at 8:41 pm

are you stupid? just change the https://mail.. line to your domain


6 dave April 24, 2007 at 1:38 am

does this work when i am using reverse proxy in apache 2? All I need to do is add in the virtual directory redirect permanent /


7 Luis May 3, 2007 at 7:15 pm

Not working for me. In Firefox I get:

“Firefox has detected that the server is redirecting the request for this address in a way that will never complete.”

I can see the location in the browser change to “https://…” but it just throws me that error.

If i write the location directly it works fine.

Thanks for any advice.


8 Danny June 15, 2007 at 2:24 am

You can’t do this in a virtual server that listens on both 80 and 443. It’ll redirect 80 (http) to the 443 (https) url, but then the https site will redirect back to itself if they’re both handled in the same virtual server block.


9 nixCraft June 15, 2007 at 10:31 am

Yes you by using RewriteCond you can use them.


10 Wolfram Jarisch July 2, 2007 at 9:21 pm

I had the same experience as Luis on 5/3/2007, running on a LAN. Interestingly, when I then remove / disable the line with an `#’ like in:

# Redirect permanent / https://ws530/

redirection takes place as originally desired (in this case w/o any site certifications). In fact, I do not know how to revert back to communicate via http:// …

What happened?


11 Anonymous May 11, 2010 at 6:26 pm

You used a “permanent” redirect. Your web browser remembers the redirect forever, and will perform the redirect without interacting with the server.


12 nixCraft July 2, 2007 at 10:45 pm


I really don’t get you can you explain in details.


13 mohit July 7, 2007 at 11:11 pm

i got s SSL for “secure.myurl.ext” and want the anybody accessing secure.myurl.ext sees the content from “myurl.ext” which is my main site, but i don’t want to do a redirect and URL above should remain as “secure.myurl.ext”
so do i need to re-upload everything to my secure folder, or i need to do a mod_rerite trick.



14 sandi July 11, 2007 at 1:51 pm

Hi there…

I just tried adding # to disable the line and redirection takes place pretty straight-forward

Strange… or this is a bug ?


15 Gitsnik September 10, 2007 at 12:12 am

sandi… did you restart apache when you disabled the line?

In my case, running the HTTPS on the same server as the HTTP, the mod_rewrite rules:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

In my webroot/.htaccess file are enough to redirect all http traffic to https.

capcha: iptable — could also use these to do the https redirection ;)


16 slava June 13, 2013 at 7:34 pm

thank you so much, that’s works very well=)


17 Huma Hashemi October 10, 2007 at 10:21 am

I have used rewrite in my httpd.conf, but it doesn’t work.
It shows this error :
HTTP Status 405 – HTTP method GET is not supported by this URL

How can I solve this problem?



18 Rami Figo December 13, 2007 at 12:09 pm

my apache listens on 80,443 ports, when i added the line
Redirect permanent / https://mail.nixcraft.com/

the redirection does not work and i could not open the site!! any ideas?!


19 Rami Figo December 13, 2007 at 12:11 pm

please note i used

Redirect permanent / https://mydomain


20 Rami Figo December 13, 2007 at 12:12 pm

where is used my domain in Redirect permanent / https://mydomain/


21 Liew January 11, 2008 at 3:30 pm

my probelm is stil wif redirecting it to
http://wwww.abc.com/abc.php -> https://wwww.abc.com/abc.php

though the code gave the effect of redirection only the http://wwww.abc.com only…

what could i have done wrong, please advice


22 ifimbres April 10, 2008 at 6:00 pm

Where exactly within the httpd.conf file do you place the line ‘Redirect permanent / https: …’

Thanks for the help.


23 SCD May 11, 2008 at 1:34 pm

This way will never work. Instead go to the sites root directory. Open up .htaccess and add line

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

This should work


24 mtupper December 7, 2011 at 9:13 am

This is the one that finally worked for me…


25 kashyap November 24, 2008 at 9:22 am

if you want to remove redirect permanent, then hash the line where you have given redirect option.
then restart the server, restarting the httpd sometimes doesn’t work.


26 mark January 2, 2009 at 12:41 am

“if you want to remove redirect permanent, then hash the line where you have given redirect option.
then restart the server, restarting the httpd sometimes doesn’t work.”

My redirect is still active how do i fix this also i have my server running on port 5500 but this doesnt work /foo http://localhost:5500/bar why not?


27 Cyde Weys January 26, 2009 at 8:40 pm

Thanks. Your second piece of advice (using RewriteEngine) was exactly what I was looking for. We just put https on a site following concerns over passwords being transmitted in the clear and this solves that issue in one fell swoop.


28 Ben February 12, 2009 at 8:15 am

I tried using this method for a server host site and everything works as it should except that the server statistics like load and uptime show as “Not Available”. These are the only two items that won’t show. Without the .htaccess file there, the server stats work fine from both http and https. I’m stumped.


29 Jeff February 20, 2009 at 3:04 pm

Change your Virtual host to list on port 443 instead of port 80 and should redirect yopur site.


30 Manoj March 5, 2009 at 6:27 am

I want to redirect all the http request to https. This works fine.
But I would like to access 1 directory(/images) in http.
Redirect permanent / https://www.example.com/

Any pointers?


31 Thorsten April 5, 2009 at 10:43 am

I have a vhost’s subdomain running with https: https://subdomain.domain.org
All requests should redirect to the unsecure variant: http://subdomain.domain.org
I cannot use .htaccess files cause both subdomains have their own directory (it’s a plesk installation). Can I configure it with a global/ permanent redirect?
Thanks a lot


32 marc April 28, 2009 at 1:57 pm

Hello guys, recently i purchased rapidssl from sslgenie. I used to redirect all my requests of http://nodewire.net/any url to https://nodewire.net/any url just by modifying .htaccess. this seemed to work well with SSLGENIE cert. However, when i switched over to Rapidssl cert, this edit in .htaccess seemed to be a problem. So i had to remove the code in htaccess, now my site has https only when a user manually types it. Please tell me how to redirect all http requests to https by editing httpd.conf or .htaccess.

PS: Rapidssl has a server root certificate while sslgenie doesnt! though this might help a bit?? (dunno)


33 hmm May 13, 2009 at 9:17 pm


i’ve used

Redirect permanent / https://my.domain.com/

but then i get into loop.
I’m trying to avoid creating .htaccess file – is there any other way to fix this?

Freebsd 7.0; apache 2.2


34 mewbie June 4, 2009 at 4:40 am

using: apache2-mpm-prefork 2.2.9-10+lenny2 on Linux Debian

1.) I have been trying for days to get redirect/force to only https without success.
I too get loop error if I add the line to apache2.conf:
Redirect permanent / https://my.domain.com/
2.) I’ve also tried both .htaccess codes posted above creating a .htaccess and put it in webroot /var/www/.htaccess (I presently don’t use any .htaccess files)
“Internal Server Error <The server encountered an internal error or misconfiguration and was unable to complete your request…..”

pico /var/www/.htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

chmod 644 /etc/apache2/.htaccess
/etc/init.d/apache2 reload

============also tried:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://myurl.com/$1 [R,L]

same error
3.) Another place I read to add this line to apache2.conf:
LoadModule rewrite_module modules/mod_rewrite.so

Cannot load /etc/apache2/modules/mod_rewrite.so into server: /etc/apache2/modules/mod_rewrite.so: cannot open shared object file: No such file or directory

This prevented my apache from restarting as suspected as I can’t find in ‘any’ of the files the “LoadModule” line, period.

The only thing I could find that sounds related was this here:
so seems this module isn’t even loaded as it’s not in the /mods-enabled/ directory.

Please if anyone could help solve this that would be great!
Thank you for your time :D


35 mewbie June 4, 2009 at 4:54 am

Forgot to post this part as well:

4.) Also read to do this and get error:
pico /etc/apache2/sites-available/default
Was this:

ServerAdmin webmaster@localhost

DocumentRoot /var/www/

Changed to:

ServerAdmin webmaster@localhost
RewriteEngine on
RewriteRule ^/(.*) https://myurl.com/$1

DocumentRoot /var/www/

/etc/init.d/apache2 reload
Syntax error on line 3 of /etc/apache2/sites-enabled/000-default:
Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server



36 Matt H June 24, 2009 at 4:04 pm

I was able to get a HTTP to HTTPS redirect working.

I put the redirect permanent in httpd.conf, in the section for a specific NameVirtualHost listener:

    ServerName mywebsite.com:80
    ServerAlias www.mywebsite.com:80
    Redirect permanent / https://www.mywebsite.com/

– Matt H
– IntuitLabs.com


37 Matt H June 24, 2009 at 4:05 pm

Awww… it removed the gt/lt symbols…. {VirtualHost} and {/VirtualHost} surround the command below the NameVirtualHost…


38 nixCraft June 24, 2009 at 4:50 pm


I’ve edited and escaped your configuration. The key is to put commands in config in pre / code tag.



39 jigish July 3, 2009 at 10:21 am

hi, want to have http://secure.jigishthakar.com

and i am using shared hosting server.
can you please tell me how can i convert my site to secure




40 Kailash July 6, 2009 at 11:03 am

i want to do something like:

https://domain.com to https://www.domain.com

As i have the site wide SSL license for subdomains.


Kailash Yadav


41 bobby July 15, 2009 at 8:12 am

I have a requirement of such that, need to forward https request to http based on the path.


42 bobby July 15, 2009 at 8:13 am

Sorry the question was not clear, again:

I have a requirement of such that, need to forward https request to http based on the path. Any ideas, how to implement in in Virtualhost ?



43 Samuel Sawyer November 1, 2009 at 9:52 pm

I am a squat on advanced Apache work. I would get a basic SSL functionality to work.
So https://foobar.com works fine and gets me all the login windows I designed. however currently all the images and other extensions like .pdf are also using the https routing.
some image referred on that https link
e.g. https://foobar.com/loginhere.jpeg c
can be displayed using https but not http
I would like to JUST limit https usage to the login window html and ALL other images pdf’s and unsecured html ( ones that do not need password ) should use HTTP NOT HTTPS
any idea how that is done ?
any idea how I can find out which particular filetypes are being redirected via https
Thanks for your help


44 raghu March 11, 2011 at 1:56 pm

Hi Sam,

Did u get the solution for your http to https limited links

i need the same pelase do suggest me how to do that

thanks in advance


45 Hemant January 30, 2010 at 7:26 pm

I want to redirect extrnal https URL on apache Reverse Proxy to HTTP
means https://abc.com (outside) = http://abc.com (real URL)
can you pls tell me how I do it



46 Bato March 25, 2010 at 6:56 pm

Thanks man…
This one works PERFECTLY!

cheers :-D


47 buffe April 19, 2010 at 11:50 am

I want to redirect
http://myserver.com/my_app/login.htm to
(only the login page) I tried various combination but it didn’t redirect. It will be a great help if some one can help.


48 zuloo April 19, 2010 at 7:19 pm

Hey guys,

those having problems in form of a redirect did not take place,
did you do a
/etc/init.d/apache2 force-reload
Actually that should only be necessary if you write it into the httpd.conf or a virtual-host-description file. when using .htaccess it should work right away…

worked fine for me

best regards


49 Mathiau July 16, 2010 at 9:38 pm

Is it possible to have ALL sites hosted on an apache server redirect to an HTTPS:// address?

instead of posting each one individual….


50 backtogeek July 19, 2010 at 1:12 pm

is it possibe to redirect to non http ot https?


Redirect permanent / rtsp://mydomain.com

I have tried but its not working


51 Chris July 23, 2010 at 6:39 pm

Maybe someone can explain this one to me.. Here is what I have in htpd.conf:
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.mowisp.com
RewriteRule ^(.*) https://mowisp.com/webmail [R]
RewriteCond %{HTTP_HOST} =admin.mowisp.com
RewriteRule ^(.*) https://mowisp.com:10000/ [R]

The admin rewrite works but the webmail rewrite does not….


52 Chris July 27, 2010 at 6:37 pm

Never mind, I figured out another way of doing what I needed. Thanks.


53 Ashok July 31, 2010 at 1:09 am


I am having two sites http://www.abc.com/app1 and https://www.abc.com/app2.
App1 is always accessed by http(no https) whereas app2 with https(no http)

Kindly suggest me solution.



54 Joe August 2, 2010 at 3:16 pm

Well have you tried using an http meta-redirect, or using .htaccess in the subdirectories, so that app1 is always https while app2 is always https, they have tutorials out there, try using meta-redirect in an index.html page, that way if you screw up you can always make a new index.html page, and not fuss around with .htaccess, its easy writing html code but not .htaccess…


55 rigidkitchen September 20, 2010 at 4:35 pm

The answer is surprisingly in another tutorial on the site.

In the directory you want to redirect to ssl:

SSLRequire %{HTTP_HOST} eq “www.nixcraft.com”

I have this under my document root in httpd.conf and it works great. I have the virtual host in ssl.conf set up to use the same directory. works great


56 Nabeel October 9, 2010 at 8:58 am


I have installed SSL certificates and now I want to move from http to https.
what should I do?
should I need to move my all files to https folder ?



57 Bipin Bahuguna February 19, 2011 at 5:39 am

I have ssl certificate for https://abc.com.
and client required it https://www.abc.com
I have redirect it via apache modrewrite abc.com to http://www.abc.com.
But prob is ssl cert is valid for only abc.com.
any idea how can i bypass ssl cert for http://www.abc.com..

Bipin Bahuguna


58 Jake Tors May 24, 2011 at 11:51 pm

Redirect permanent did not work at all. Tried it inside and outside of the virtual host.

Do more research next time


59 Tim June 10, 2011 at 8:18 pm

Agh! Do what SCD says!

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]


60 Mikem June 22, 2011 at 9:56 pm

Also set AllowOverride All in httpd.conf


61 Stephen July 15, 2011 at 12:48 am

Dows anyone have any idea please on what lines of code that I’m going to add into the htaccess file? Basically, I just need my login page, registration page to be in SSL. The rest of the pages will be in http like the index.php. I have the SSL installed already in my server. I have the htaccess code to redirect all pages into https but I don’t need the whole site to be in https. I have this few lines of code and this make the whole site in https:

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^index.php$ https://www.mysite.com/

I need only these pages to be https and the rest of the site to load in http


Any idea please on how to make it that only login, registration to be in https? Then if user open it in http it will automatically be redirect into https. If user open index page in https it will automatically be change into http. Please help.


62 anonymous September 7, 2012 at 3:34 am

try this

RewriteCond %{REQUEST_URI} ^?do=login\ [OR]
RewriteCond %{REQUEST_URI} ^?do=reg\ [OR]
RewriteCond %{REQUEST_URI} ^?do=login&url=sell\ [OR]
RewriteCond %{REQUEST_URI} ^?do=login&url=myaccmain\ [OR]
RewriteCond %{REQUEST_URI} ^?do=login&url=sindex\ [OR]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


63 Jan August 24, 2011 at 2:48 pm


there are a lot of domains hosted in my dedicated server.
There is an alias /webmail pointing to the installed webmail-interface which could be used from all domains on my server

e.g. there are the domains foobar1.de, foobar2.net, foobar3.com, foobar4.de, foofoobarbar.info, …
and the webmail client is reachable: e.g. foobar1.de/webmail , … , foofoobarbar.info/webmail

That’s fact and running.

Now i want to force all “/webmail”-calls to “https://”, so that the call “foobarxy.org/webmail” automatically chanches to “https://foobarxy.org/webmail” without regarding other calls like foobar.org (homepage) oder foobar3.com/directoryxy or others.

The aim is to force only the “/webmail” calls to htts not the others.

Is there a simple way?


64 anon September 21, 2011 at 9:01 pm

This worked for me, using apache2 and 2 virtual hosts:

1. Type the following command in the terminal:

sudo a2enmod rewrite

Add the following to /etc/apache2/sites-available/default under

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Restart Apache:

sudo /etc/init.d/apache2 restart


65 Vishva October 19, 2011 at 4:33 am

What i want to achieve is configure outbound proxy for specific HTTPS urls. Its a white list validation. e.g. If i (my application) hits a specific HTTPS URL , then only redirect should happen .. something like this –

RewriteCond %{THE_REQUEST} ^GET\ (http://www.google.com/.*)\ HTTP [OR] RewriteCond %{THE_REQUEST} ^GET\ (http://www.oracle.com/.*)\ HTTP RewriteRule . proxy:%1 [L]

RewriteCond %{THE_REQUEST} ^CONNECT\ (www.abc.com):443/?.*)\ HTTP RewriteRule . proxy:https://%1 [L]

The first part for HTTP works fine. So outbound URLs which start with HTTP gets redirected according to rule but if i hit HTTPS , it doesnt work .. it gives forbidden error or cookie error..

Can any body please help.


66 Sudeep February 16, 2012 at 8:57 am

Hi my site has SSl installed.
I want all www and non www http traffic to redirect on https://www. version
I used the above code

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

But my innerpages also get redirected to home page please help.

FYI: I am using Drupal+Ubercart


67 adriano May 28, 2012 at 11:02 pm

The best solution to HTTP requests to HTTPS is at the httpd wiki:



68 anonymous September 7, 2012 at 3:24 am

Hi Sudeep just paste this code:

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

in .htaccess under the

# To redirect all users to access the site WITHOUT the ‘www.’ prefix,
# (http://www.example.com/… will be redirected to http://example.com/…)
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]

After that, it will work.


69 Randeep October 16, 2012 at 12:31 pm

Is there anyway I can redirect

http requests to http
https request to https

I mean through redirect/rewrite rules?


70 manish October 23, 2012 at 11:56 am

how to redirect https to http with htaccess. please anyone give the method..


71 Tobi January 9, 2013 at 4:05 pm

If you want to have a redirect from HTTP->HTTPS but not for a specifice subfolder (eg for images) then you could use the following rewrite rules:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !.*/img/.*
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
in this example it will redirect every request to HTTPS if it is not HTTP and has not /img/ in the URL.


72 it's_me April 23, 2013 at 12:55 pm

I want to do some redirections like this:
base-url.com -> base-url2.com (but only if no subdir is given)
base-url.com/any_subdir -> https://base-url.com/any_subdir
and, if possible, this rulsets only within the site-config not within .htaccess, cause there are developers cleaning folders… this is driving me nuts…
I can’t get it. Can anyone give me a hint, please?


73 it's_me April 24, 2013 at 7:40 am

Sorry, my initial description was to short.

What I need to do is, to do two redirects on one base-url with two different conditions. First is to redirect a request with just the base-url (like _http://some_url.org) to _http://some_other_url.org .

_http://some_url.org -> _http://some_other_url.org

The second one is, if _http://some_url.org/some_subdir is requested it shoud be redirected to SSL of the same host _https://some_url.org/some_subdir .
So in case 2 it should not be redirected to some_other_url.org .

_http://some_url.org/some_subdir -> https_://some_url.org/some_subdir

Both rewrites are not verry complex for its own, but I can’t get them working together.
So my problem is, how do I have to set the RewriteCond (to be exact the regexp) to do the matching. The http->https overrules always.

I did several experiments with RewriteCond, RewriteRule, RedirectMatch but I didn’t get it. Does anybody have an idea?

Oh, btw this should be done by the vhost-config, not with .htaccess-files in document-folders. It’s a restriction I’m not responsible for :-( cause developers sometimes empty the doc-folders.

Sorry, I had to do this _http because of this editor to not recognize this “URLs”.
thanks a lot

best regards, M.


74 it's_me April 25, 2013 at 7:44 am

> RewriteRule ^/$ http://some_other_url.org [R=permanent,L,NS]
> RewriteCond %{HTTPS} !=on [NC]
> RewriteRule ^/(.*) https://some_url.org/$1 [R=permanent,L,NS]

PERFECT! Thanks a lot Jim.
This exactly solves my Problem.

btw. this solutuion is not from here, but I want to tell the answer ;-)
Best regards, M.


75 vivek December 18, 2013 at 4:53 am

How to redirect https to http ?


76 Amit Desai January 31, 2014 at 6:34 am

I have enabled https and also able to navigate application using http and https without rewrite. Apache 2.2.24. but see a strange behavior.

Receiving 400 bad request if passing http://hostname.com/webapp-name but works fine with http://hostname.com/webapp-name/ don’t know how / can help to redirect to https.

Also, enabled the rewrite with following in httpd.conf but don’t see a difference.
Also, http redirection is going improper. Please help me as today is my submission

# Rewrite Engine
RewriteEngine On
# now the rewriting rules
RewriteCond %{SERVER_PORT} !^443$
RewriteRule .* https:///webapp-name [R,L]


77 srinivas rompala August 24, 2014 at 6:07 am

SetHandler weblogic-handler

WebLogicHost 10.95.XX.XX
#MatchExpression *.jsp
#MatchExpression *.html
Debug ALL
DebugConfigInfo ON
WLLogFile c:/weblogictemp/projectname.log
WLTempDir c:/weblogictemp

SetHandler weblogic-handler
WebLogicPort 7003

SetHandler weblogic-handler
WebLogicPort 7005


78 srinivas rompala August 24, 2014 at 6:04 am

Based on user clicks on language browser redirects to specific language….i18N support


RewriteEngine on
## Rewriting url for ARabic support browser
RewriteCond %{HTTP:Accept-Language} ^ar [NC]
RewriteRule ^/ProjectName/$ [L,R=301]

## Rewriting url for EN english supports browser
RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteRule ^/ProjectName/$ [L,R=301]


79 srinivas rompala August 24, 2014 at 6:09 am

Ho to redirect to another default login page whne user clicks incomplete url…suppose if user types then enter i want to redirect to this is suppport for cluster environment in prodcution…


80 RM November 13, 2014 at 3:49 pm

I have read all the way to the bottom. If the redirect permanent / https://whatev.hher.com does not work. Either delete or comment it out, in the same area add the

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

I searched and tested for two days anthis worked.


Leave a Comment

Previous post:

Next post: