url-redirection


Redirection With https from www to non-www


I have very simple requirement, I want a set of RewriteRule which can do the following things
Redirect all www request to non-www.
Redirect all request to https.
Ultimately my URL requirement is like http://domain.com
I am able to do most things but a request like https://www.domain.com is not redirecting.
This my redirection rule:
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*) http://domain.com/$1 [L,R=301]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Please suggest what I need to do.
Use this code below
RewriteEngine On
#Redirect HTTP with www to HTTPS without www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule .* https://%1%{REQUEST_URI} [R=301,L]
# Redirect HTTP without www to HTTPS without www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect HTTPS with www to HTTPS without www
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule .* https://%1%{REQUEST_URI} [R=301,L]

Related Links

Spotfire Redirecting to home after link click
how to get url redirect video from lh3.googleusercontent with PHP
Cloudflare redirect subdomain to URL
How to redirect all pages in a subfolder to a single page
Redirecting a link to the same page if the page of that url is already opened
How to redirect and keep the original url unchanged?
Redirection handling in ROKU
Redirect script not working in Internet Explorer
Capture PersonID from INSERT statement and use it to redirect to details page
How do I disallow search robots from www.example.com and exsample.com
How to redirect a page while counting page hits?
Redirect any outbound traffic to local IP
htaccess redirecting with NC parameter
Having troubles in cPanel with a redirect
How to cancel redirection of page with click?
Qtranslate changes to default language clicking any son post

Categories

HOME
jpa
yahoo-finance
saml-2.0
r-googlesheets
bitbucket-api
telegram-bot
zip
crystal-reports-2013
vert.x
opengl-3
modal-dialog
arangodb
drop-down-menu
gson
java.util.logging
naivebayes
libusb
package-managers
template-engine
soci
gmm
topology
react-toolbox
postscript
hta
displaytag
draft-js-plugins
itunes
angularjs-components
underscore.js
genexus-sd
bioinformatics
nsurl
calculation
panoramas
hreflang
gojs
jwplayer6
python-pptx
raft
swagger-php
magento-1.9.3
parser-generator
subclipse
procfile
google-cse
zenhub
reindex
filehandle
dt
otp
pdf-conversion
java-websocket
vcloud-director-rest-api
chromium-os
cudd
latin
neon
wso2developerstudio
nupic
asyncdisplaykit
java-money
django-urls
extjs-grid
text-search
omnifaces
showdialog
uncaught-typeerror
crowd
administration
contrast
nsmenu
syndicationfeed
openargs
jammer
dtmf
printdialog
mvc-editor-templates
pclzip
booksleeve
device-width
sentestingkit
extconf.rb
httponly
azman
promotion-code
lr
http-daemon
unattended-processing
metaweblog
uideviceorientation
delimited-text
maven-1
dsl-tools
blind

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App