Forum Moderators: phranque

Message Too Old, No Replies

url masking using .htaccess

         

lleighh

1:29 am on Jul 6, 2005 (gmt 0)

10+ Year Member



okay, i'm a web grfx designer that's forced to tinker with the occasional code so don't get too *nixy on me.

i've looked around the forum but i haven't found a fix for my situation ...

i set up a client's helpdesk on my own web space but i used their subdomain. i want to be able to redirect visitors to the files on my web space but mask it so they don't know they are actually looking at another domain. my client is on a linux server, shared IP, doesn't support PHP. the .htaccess file is in the root.

below is what my .htaccess looks like ... of course, it does NOT work cuz i don't really know what i'm doing. so don't be too too brutal.

RewriteEngine on
RewriteRule ^index\.html$ example.com/ex/index.php [R]

[edited by: jdMorgan at 3:23 am (utc) on July 6, 2005]
[edit reason] Exampified. [/edit]

jdMorgan

3:22 am on Jul 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



lleighh,

Welcome to WebmasterWorld!

It sounds like you want to proxy request for certain files over to your server. In that case, check out RewriteRule's [P] flag in the mod_rewrite documentation [httpd.apache.org].

The biggest part of this job is to define the pages that you want to proxy. This part is identical to what you're doing now with the redirect in your code, and I'd encourage you to go ahead and use the redirect until you get all of the URLs redirected properly. Then change from the [R] flag to [P] and the action will become transparent.


RewriteEngine on
RewriteRule ^index\.html$ http://www.example.com/ex/index.php [R,L]

You can redirect individual files, entire directories, or both. Finding the most efficient way to describe the files that need to be redirected is the greater part of the job.

Jim

lleighh

11:37 am on Jul 6, 2005 (gmt 0)

10+ Year Member



jdMorgan, i made the changes you suggested and i still get the same result as before. should i be seeing a change in the index.html of the orig site? a rewriting of something in the head, maybe? i don't see any rewriting. could my .htaccess file be in the wrong place?

jdMorgan

6:21 pm on Jul 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Make sure you are flushing your browser cache (or Temporary Internet Files in IE) before testing any changes.

The code has to go into a directory in a path where it will be executed when the 'help' files are requested on your client's server.

While testing using 301 or 302 redirects, you will see the URL update in your browser's address bar. Once you get all files redirecting properly, then you can change the [R] flag to [P] and you should no longer see the address bar update. If the request results in the page being served by your server, then it's working.

Jim