Solved

rewrite/redirect

Posted on 2006-11-06
4
242 Views
Last Modified: 2010-03-04
Hello,

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


public_html/.htaccess
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


public_html/subdomain/.htaccess
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.

Thanks,
/wl
0
Comment
Question by:windylad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 43

Accepted Solution

by:
ravenpl earned 400 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]

#public_html/subdomain/.htaccess
#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]
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 17880612
0
 

Author Comment

by:windylad
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.

Thanks,
/wl
0
 
LVL 43

Expert Comment

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

Featured Post

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

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

Suggested Solutions

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

697 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