Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

rewrite/redirect

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

618 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