cenocre wrote
I'm fairly new to this so any help on what the actual rewrite string looks like that does a 301 redirect from
www.domain.com to domain.com would be GREATLY appreciated.
This is going to be long, sorry.
Here is the kicker, and one pure pain in the rear! ...
First I noticed that if I entered
aprelium[dot]com (as an example, and I am using the [dot] to prevent this post from interfering with Aprelium's SEO) the domain would redirect to,
www[dot]aprelium[dot]com/, which is exactly what I wanted to achieve in my own domain redirect! However, if I enter,
aprelium[dot]com/// in a browser address bar the domain redirects to
www[dot]aprelium[dot]com///, and furthermore if I enter
www[dot]aprelium[dot]com/// in a browser address bar the domain remains as
www[dot]aprelium[dot]com///, rather strange and not at all what I want...
I want
my_domain[dot]com to redirect permanently to
www[dot]my_domain[dot]com/,
minus the multiple slashes.
First, and acting on the advice of Aprelium Technical Support, I created two domains:
my_domain[dot]com and
www[dot]my_domain[dot]com.
I left my website, document folder, etc., empty in
my_domain[dot]com and used the
"URL Rewriting Rules - Edit" feature to redirect permanently to
www[dot]my_domain[dot]com, which serves my website, documents, scripts, etc. The rewrite rule provided worked like a charm, except for the multiple trailing slashes (as indicated above).
---
Here is my "fix" of sorts.
Using the "URL Rewriting Rules - Edit" feature I added to
my[dot]domain[dot]com the following:
Virtual Path Regular Expression:
^/*(([^/]+/)*)/+(.*)$
Case Sensitive:
Not Checked
Conditions:
None Included
Apply to subrequests too:
Checked
If this rule matches:
Perform an external redirection
Redirect to:
//www[dot]my_domain[dot]com/$1$3
Append Query String:
Checked
Escape Redirection Location:
Checked
Status Code:
301 - Moved Permanently
---
This worked like a charm! I tried to screw it up with many insane variations, some listed below:
my_domain[dot]com//,
my_domain[dot]com/index.html//,
/my_domain[dot]com//index.html////, and each redirected to either
www[dot]my_domain[dot]com/ or
www[dot]my_domain[dot]com/index.html/ without fault. But herein lies my problem now, if I enter any insane variation of the above but with the
www, as in
www[dot]my_domain[dot]com//index.html/// in a browser address bar the domain remains as
www[dot]my_domain[dot]com//index.html/// (as an example), and back to square one. I solved the original problem, which pleases me no end, but I still have the multiple slashes with "
www" as indicated in the
www[dot]aprelium[dot]com/// example above.
I apologize for the long post, but I figure this is a problem with many a user on this forum and I would like to put it to rest here, for the last time.
1. How do I remove any and all-multiple slashes, trailing and otherwise, from
www[dot]my_domain[dot]com/, now that
my_domain[dot]com is no longer a problem?
2. How do I redirect any trailing instance of index.*, home.*, etc. to
www[dot]my_domain[dot]com/ as first entry (the landing or doorway) to my website?
The first question is a priority, and "cenocre", just remove the
www from my example (reverse order) and you have your answer.
~AJ~