473,379 Members | 1,191 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

redirect with exception for subdomain

1
I have modified the code and am close, just one small problem.

What I have is this directory structure:

public_html
subDirA (This is where the website for example.com resides and is internally rewritten to public_html. The user never sees subDirA.

subDirB (This is actually the new subdomain. Internally it looks like a subdirectory under public_html. In the code below, the subdomain displays as subDirB.example.com which is what I want and it no longer is being rewritten to subDirA. So this is working the way I want now.)

subsubdir (This is a subdirectory under subDirB.example.com. This needs to be internally rewritten back to subDirB.example.com . This is the problem. I can not make this happen. It is still being displayed as subDirB.example.com/subsubDir instead of subDirB.example.com.


Here is the latest code where everything works right except the internal rewrite of subsubdir back to http://subDirB.example.com

I messed up subsubDirlaining my problem. I have modified the code and am close, just one small problem.

What I have is this directory structure:

public_html
subDirA (This is where the website for example.com resides and is internally rewritten to public_html. The user never sees subDirA.

subDirB (This is actually the new subdomain. Internally it looks like a subdirectory under public_html. In the code below, the subdomain displays as http://subDirB.example.com which is what I want and it no longer is being rewritten to subDirA. So this is working the way I want now.)

subsubdir (This is a subdirectory under http://subDirB.example.com. This needs to be internally rewritten back to http://subDirB.example.com . This is the problem. I can not make this happen. It is still being displayed as http://subDirB.example.com/subsubDir instead of http://subDirB.example.com.


Here is the latest code where everything works right except the internal rewrite of subsubdir back to http://subDirB.example.com

Expand|Select|Wrap|Line Numbers
  1. AddHandler server-parsed .htm .html
  2. #
  3. Options +FollowSymLinks 
  4. RewriteEngine On
  5. RewriteBase /
  6. #
  7. RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC] 
  8. RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
  9. RewriteRule ^(.+/)?index\.(php|html?)$ http://example.com/$1 [R=301,L] 
  10. RewriteCond %{HTTP_HOST} ^subDirB\.example\.com [NC] 
  11. RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
  12. RewriteRule ^(.+/)?index\.(php|html?)$ http://subDirB.example.com/$1 [R=301,L] 
  13. #
  14. RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
  15. RewriteRule ^subDirA(/(.*))?$ http://example.com/$2 [R=301,L] 
  16. RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
  17. RewriteCond %{HTTP_HOST} ^subDirB\.example\.com [NC] 
  18. RewriteRule ^subsubDir(/(.*))?$ http://subDirB.example.com/$1 [R=301,L] 
  19. RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC] 
  20. RewriteCond %{HTTP_HOST} !^example\.com$  [NC]
  21. RewriteRule ^(.*)$ http://example.com/$1 [R=301,L] 
  22. #RewriteCond %{HTTP_HOST} ^(www\.)?subDirB\.example\.com [NC] 
  23. #RewriteCond %{HTTP_HOST} !^subDirB\.example\.com$ [NC]
  24. #RewriteRule ^(.*)$ http://subDirB.example.com/$1 [R=301,L] 
  25. RewriteCond %{HTTP_HOST} !^subDirB\.example\.com$ [NC]
  26. RewriteRule !^subDirA(/.*)?$ /subDirA%{REQUEST_URI} [QSA,L] 
  27. #
  28. RewriteCond %{HTTP_HOST} ^subDirB\.example\.com$ [NC]
  29. RewriteRule !^subsubDir(/.*)?$ /subsubDir%{REQUEST_URI} [QSA,L] 
  30. #
  31. #
  32. ErrorDocument 404 /missing.html
  33.  
Feb 18 '10 #1
0 2044

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Leon | last post by:
How do I point a sub-domain to a sub-directory or .aspx page of my site using asp.net? I'm using a shared hosting service, that does not offer subdoman forwarding. however, you can write your...
1
by: Michael Horton | last post by:
SQL Version: 2000 OS Version: Server 2003 I've got a sub-domain (test.mydomain.com) that I use for testing. In it I've got some un-common files available for download (.car extension) along with...
1
by: MikeM | last post by:
We are getting a behavior on a Response.Redirect("SomeUrl", True) that I'm hoping someone can explain. This all refers to the code snip at the end. By the way, this is all VB ASP.NET v1.0 code. ...
6
by: Leon | last post by:
how do I get just the "System.Exception: The subdomain does not exist" message and not the following from a unhandle exception? System.Exception: The subdomain does not exist at...
1
by: perspolis | last post by:
Hi If I want to create subdomain for my site dynamicaly how can I do that with ASP.NET? or is it possib;e to create subdomain with IIS?? thanks
4
by: myalo | last post by:
In the transition of a website from one domain to another for exmaple from www.oldsite.com to www.newsite.com I need to "rewrite" the URL so all links to the old site will be linked to the new site...
12
by: Tina | last post by:
Our company domain, say, wombat.com needs to create several subdomains: support, training, and purchase are three of the subdomains needed. So when someone browses to //training.wombat.com they...
1
by: Josh | last post by:
I have a question about subdomains. I would like my website to have subdomains that essentially show my regular main website, except that the subdomain passes as a variable on all pages so that I...
5
by: mcfly1204 | last post by:
We host personalized websites that are generated on the fly on a per campaign basis. Currently, when a campaign is over, we simply take down the site. Now, we are looking to have any post-campaign...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.