Solved

rewrite/redirect

Posted on 2006-11-06
4
238 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
  • 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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

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…
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now