Posted on 2006-11-06
Medium Priority
Last Modified: 2010-03-04

Can someone help out with these redirects/rewrites...

http://www.domain.com/admin -> http://www.domain.com:1234
http://www.domain.com/admin/ -> http://www.domain.com:1234

http://www.domain.com/email -> httpS://www.domain.com/email/application/file.htm
http://www.domain.com/email/ -> httpS://www.domain.com/email/application/file.htm

http://www.domain.com/subdomain -> httpS://subdomain.domain.com/app1/file.htm
http://www.domain.com/subdomain/ -> httpS://subdomain.domain.com/app1/file.htm

http://subdomain.domain.com/* -> http://subdomain.domain.com/*

http://subdomain.domain.com/app1 -> httpS://subdomain.domain.com/app1/file.htm
http://subdomain.domain.com/app1/ -> httpS://subdomain.domain.com/app1/file.htm
httpS://subdomain.domain.com/app1 -> httpS://subdomain.domain.com/app1/file.htm
httpS://subdomain.domain.com/app1/ -> httpS://subdomain.domain.com/app1/file.htm

http://subdomain.domain.com/app2 -> httpS://subdomain.domain.com/app2/file.htm
http://subdomain.domain.com/app2/ -> httpS://subdomain.domain.com/app2/file.htm
httpS://subdomain.domain.com/app2 -> httpS://subdomain.domain.com/app2/file.htm
httpS://subdomain.domain.com/app2/ -> httpS://subdomain.domain.com/app2/file.htm

http://subdomain.domain.com/app3 -> httpS://subdomain.domain.com/app3/file.htm
http://subdomain.domain.com/app3/ -> httpS://subdomain.domain.com/app3/file.htm
httpS://subdomain.domain.com/app3 -> httpS://subdomain.domain.com/app3/file.htm
httpS://subdomain.domain.com/app3/ -> httpS://subdomain.domain.com/app3/file.htm

In another thread, http://www.experts-exchange.com/Web/Web_Servers/Apache/Q_22047784.html#17866370, ravenpl helped with the http://subdomain.domain.com/* -> http://subdomain.domain.com/* rewrite rule...

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?subdomain.domain.com
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R]

I just need to tie in the rest.  I tried and got some undesired results.

Question by:windylad
  • 3
LVL 43

Accepted Solution

ravenpl earned 1600 total points
ID: 17880598
RewriteRule ^admin$ http://www.domain.com:1234/ [L,R]
RewriteRule ^admin/.* http://www.domain.com:1234/ [L,R]
RewriteRule ^email$ httpS://www.domain.com/email/application/file.htm [L,R]
RewriteRule ^email/.* httpS://www.domain.com/email/application/file.htm [L,R]
# http://www.domain.com/subdomain -> httpS://subdomain.domain.com/app1/file.htm
# we can't catch any subdomain, as it would catch any subfolder as well. Instead create rule for each subdomain
RewriteRule ^subdomain$ httpS://subdomain.domain.com/app1/file.htm [L,R]
RewriteRule ^subdomain/.* httpS://subdomain.domain.com/app1/file.htm [L,R]

#http://subdomain.domain.com/* -> http://subdomain.domain.com/*
#it changes nothing ?
RewriteRule ^app(.)/$ httpS://subdomain.domain.com/app$1/file.htm [L,R]
RewriteRule ^app(.) httpS://subdomain.domain.com/app$1/file.htm [L,R]
LVL 43

Expert Comment

ID: 17880612

Author Comment

ID: 17880853
Sorry that should have been

http://subdomain.domain.com/* -> httpS://subdomain.domain.com/*

The reason I wanted that there is if a user knows the full path to a particlar file, they could type that in and use regular http, which I want to avoid.  Does this make things more complicated with the other rules?

I realise that the intelligent thing to do is read man pages at apache.org, but this is a once off configuration so I thought it best to ask an expert.

LVL 43

Expert Comment

ID: 17880880
#http://subdomain.domain.com/* -> httpS://subdomain.domain.com/*
You already have it - right? You posted sollution to this in the question itself.

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month16 days, 7 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question