domain1.com.au redirect to domain.com + masking

Using a single web hosting account to host multiple sites

Postby Lexy » Mon Jun 30, 2008 8:10 pm

Yes, the links in the EStore do contain "/MY-New-EStore".
I'm happy to leave them in there if I could get it working....

I tried this:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(.*)$ http://stores.channeladvisor.com/$1 [P,L]

It gives me Access Denied errors. Funny, because the code below works, but only for getting to the home page. After that, none of the links work.
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(.*)$ http://stores.channeladvisor.com/MY-New-EStore/$1 [P,L]


What about displaying mynewestore.com.au in the address bar no matter what page I'm on. ie, every page displays: mynewestore.com.au in the address bar. Would that be easier?

Tx Lexy
Lexy
 
Posts: 12
Joined: Wed Jun 04, 2008 9:29 pm
Location: Sydney

Postby richardk » Tue Jul 01, 2008 3:47 pm

What URL are you going to?

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(MY-New-EStore)?$ /MY-New-EStore/ [NC,R=301,L]
RewriteRule ^(MY-New-EStore/.*)$ http://stores.channeladvisor.com/$1 [P,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Lexy » Tue Jul 01, 2008 5:24 pm

Tx for reply Richard.

I type in mynewestore.com.au into the address bar, and it brings me to: http://mynewestore.com.au/MY-New-EStore/

The real URL is http://stores.channeladvisor.com/MY-New-EStore/

...so the redirection is working, and the rewrite seems to be working. But after landing on the sites home page, none of the links will work.

My .htaccess file is as per your last post.

Any further help greatly appreciated :)

rgds,
Lexy
Lexy
 
Posts: 12
Joined: Wed Jun 04, 2008 9:29 pm
Location: Sydney

Postby richardk » Wed Jul 02, 2008 6:55 am

If you change "stores.channeladvisor" to "example" do you still get a bad request message?

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(MY-New-EStore)?$ /MY-New-EStore/ [NC,R=301,L]
RewriteRule ^MY-New-EStore/.*$ http://stores.channeladvisor.com%{REQUEST_URI}?%{QUERY_STRING} [P,L]


Also try replacing [P,L] with [NE,P,L].
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Lexy » Tue Jul 08, 2008 6:45 pm

Tx Richard,

Here are the results of my tests:

Test1:
RewriteRule ^(RC-Hobby-EStore)?$ /RC-Hobby-EStore/ [NC,R=301,L]
RewriteRule ^(RC-Hobby-EStore/.*)$ http://example1.com/$1 [P,L]
result: (404 error)

Test2:
RewriteRule ^(RC-Hobby-EStore)?$ /RC-Hobby-EStore/ [NC,R=301,L]
RewriteRule ^(RC-Hobby-EStore/.*)$ http://stores.channeladvisor.com/$1 [P,L]
result:the redirect works, but then none of the links will work. "F5 - Refresh" will work.

Test3:
RewriteRule ^(RC-Hobby-EStore)?$ /RC-Hobby-EStore/ [NC,R=301,L]
RewriteRule ^RC-Hobby-EStore/.*$ http://stores.channeladvisor.com%{REQUEST_URI}?%{QUERY_STRING} [P,L]
result:redirect works. none of the links work, get 400 -bad request. "F5 - Refresh" will work.

Test4:
RewriteRule ^(RC-Hobby-EStore)?$ /RC-Hobby-EStore/ [NC,R=301,L]
RewriteRule ^RC-Hobby-EStore/.*$ http://example1.com%{REQUEST_URI}?%{QUERY_STRING} [P,L]
result: (404 error)


Test5:
RewriteRule ^(RC-Hobby-EStore)?$ /RC-Hobby-EStore/ [NC,R=301,L]
RewriteRule ^RC-Hobby-EStore/.*$ http://stores.channeladvisor.com%{REQUEST_URI}?%{QUERY_STRING} [NE,P,L]
result: (404 error)

Does this help?
Thanks, Mark.
Lexy
 
Posts: 12
Joined: Wed Jun 04, 2008 9:29 pm
Location: Sydney

Postby richardk » Wed Jul 09, 2008 3:33 pm

The problem is the spaces in the URL. I have an ugly solution that should work most of the time (up to 8 spaces)
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(RC-Hobby-EStore)?$ /RC-Hobby-EStore/ [NC,R=301,L]

# 8 spaces
RewriteRule ^(RC-Hobby-EStore/.*)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.*)$ http://stores.channeladvisor.com/$1\%20$2\%20$3\%20$4\%20$5\%20$6\%20$7\%20$8\%20$9 [P,L]
# 7 spaces
RewriteRule ^(RC-Hobby-EStore/.*)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.*)$ http://stores.channeladvisor.com/$1\%20$2\%20$3\%20$4\%20$5\%20$6\%20$7\%20$8 [P,L]
# 6 spaces
RewriteRule ^(RC-Hobby-EStore/.*)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.*)$ http://stores.channeladvisor.com/$1\%20$2\%20$3\%20$4\%20$5\%20$6\%20$7 [P,L]
# 5 spaces
RewriteRule ^(RC-Hobby-EStore/.*)\s+(.+)\s+(.+)\s+(.+)\s+(.+)\s+(.*)$ http://stores.channeladvisor.com/$1\%20$2\%20$3\%20$4\%20$5\%20$6 [P,L]
# 4 spaces
RewriteRule ^(RC-Hobby-EStore/.*)\s+(.+)\s+(.+)\s+(.+)\s+(.*)$ http://stores.channeladvisor.com/$1\%20$2\%20$3\%20$4\%20$5 [P,L]
# 3 spaces
RewriteRule ^(RC-Hobby-EStore/.*)\s+(.+)\s+(.+)\s+(.*)$ http://stores.channeladvisor.com/$1\%20$2\%20$3\%20$4 [P,L]
# 2 spaces
RewriteRule ^(RC-Hobby-EStore/.*)\s+(.+)\s+(.*)$ http://stores.channeladvisor.com/$1\%20$2\%20$3 [P,L]
# 1 spaces
RewriteRule ^(RC-Hobby-EStore/.*)\s+(.*)$ http://stores.channeladvisor.com/$1\%20$2 [P,L]
# No spaces
RewriteRule ^(RC-Hobby-EStore/.*)$ http://stores.channeladvisor.com/$1 [P,L]


Do you have access to the httpd.conf file of your server?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Lexy » Thu Jul 10, 2008 2:01 am

Thanks Richard,

I'll give these a test and report back.

Yes, I do have access to the httpd.conf file, that's how I installed mod_proxy. Are you thinking of mod_proxy_http ?

cheers,
Lexy
Lexy
 
Posts: 12
Joined: Wed Jun 04, 2008 9:29 pm
Location: Sydney

Postby Lexy » Thu Jul 10, 2008 2:26 am

Update:

The redirect works, but still no luck with any of the links.

what about a different tack: Is it easier to just perform a redirect, then no matter what the link is, just display rchobbyestore.com.au in the address bar?

Thanks, Lexy
Lexy
 
Posts: 12
Joined: Wed Jun 04, 2008 9:29 pm
Location: Sydney

Postby richardk » Sun Jul 13, 2008 10:34 am

Yes, I do have access to the httpd.conf file, that's how I installed mod_proxy. Are you thinking of mod_proxy_http ?

Yes, try this in your domain's <VirtualHost>
Code: Select all
RedirectMatch 301 ^/(RC-Hobby-EStore)?$ /RC-Hobby-EStore/

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass /RC-Hobby-EStore http://foo.example.com/RC-Hobby-EStore
ProxyPassReverse /RC-Hobby-EStore http://foo.example.com/RC-Hobby-EStore


If it has the same problem, a RewriteMap to replace the spaces might work. It might have to be a short program though, not the built-in escape function.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby qlex » Tue Jan 13, 2009 11:56 pm

Hi.
first of all, congratulations on this topic. It has helped me understand the power of .htaccess.
I have stumbled upon a similar problem as lexy in post and followed Richard's suggestion to turn on mod proxy on my server, however this didnt help.

Here is my situation:

Got a dedicated server which has this address: subdomain.something.eu

As this address is not easy to remember, I have bought a domain something.pl and created subdomain.something.pl. this has been done using cpanel with my standard hosting company account and i have access to ftp directory of that subdomain where i put the .htaccess file.

my goal is to have people type in something.pl, display the content of subdomain.something.eu, but see something.pl as url in browser.

Test 1 of .htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ http://subdomain.something.eu/$1 [P,L]

result: 404 Not found

Test 2 of .htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ http://subdomain.something.eu/$1 [R,L]

result: subdomain.something.eu loads and displays that url in browser.

im stuck, do you have any other suggestions ?

Regards,
Qlex
qlex
 
Posts: 1
Joined: Tue Jan 13, 2009 11:49 pm

PreviousNext

Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 18 guests

cron