ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > Living Room

URL Rewrite Problem

<< < (2/2)

BGM:
Thanks for your help. 

However, this isn't a coding issue - I'm not writing this into the aspx code.  The System is IIS7, and I am using the webserver's GUI to rewrite the URL for incoming http requests.

wraith808:
Probably the reason you're not getting views, etc, is that it's not a URL-rewrite issue either; it's a regex issue.  The . character is a regex character, so you have to escape it.  Also, you should probably make the / optional.  I put some regex below.


--- Code: Text ---.*sub1\.domain\.org/*.*
In the future, you might want to run your regex through a tester to make sure it's doing what you want it to do.  There are several online.  RegexHero is one, but it uses the Silverlight parser, so if you're typically doing perl rather than .net expressions, you'll want to find another.  I use RegexBuddy... but it's a paid app.  Very much worth it to save sanity.

BGM:
Ah, the regex did, indeed help - thank you very much.  I tried with some escapes but was having troubles.
Now it rewrites to the site correctly, whether being http or https.


However, I still have a problem.
If I type https://sub2.domain/page_from_sub1
it rewrites to
https://sub1.domain/page_from_sub1

It is supposed to get my my error page because page_from_sub1 does not exist on sub2.
How do I fix that?

The regex is correct. http://sub2.domain never matches the regex.  So why is it getting rewritten?

Navigation

[0] Message Index

[*] Previous page

Go to full version