?
Solved

rewrite/redirect

Posted on 2006-11-06
4
Medium Priority
?
245 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 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]

#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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

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…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

752 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