Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite Help!

New to mod_rewrite

         

edushkushot

4:41 am on Mar 31, 2004 (gmt 0)



Hi there,

I'm hoping someone can explain to me mod_rewrite. I have a URL www.example.org but when the URL shows up, it shows the path on the end like this:
[example.org...]

I want to only display [example.org...]

This is what I have tried so far:


RewriteEngine On
RewriteCond %{HTTP_HOST} www.example.org/(.*)
RewriteRule http://www.example.org/(.*) http://www.example.org

It is placed in a .htacess file in the /example directory. Any help is appreciated. I should mention the URL is being redirected to by a subdomain script at our webhost, hostsnare.net and uses $HTTP_HOST in an index.cgi file written in PERL. I have full access to this file as well.

Thanks.

[edited by: jdMorgan at 5:34 pm (utc) on Mar. 31, 2004]
[edit reason] Removed URLs per TOS [/edit]

jdMorgan

5:41 pm on Mar 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



edushkushot,

Welcome to WebmasterWorld [webmasterworld.com]!

The problem appears to be that the script you mention is using an external redirect rather than an internal rewrite to "map" subdomains into the subdirectories of the main "account."

Because of this external redirect, the new URL is displayed in the browser address bar.

This is also highly inefficient, since *every* request to your server results in a redirect, and so each page image, script, etc. has to be requested twice by the client browser.

You can replace this function with the internal rewrite function of mod_rewrite and eliminate the defective script, or you can modify the script to "include" each requested resource (page, image, script, etc.) and serve it from the requested subdomain, but I believe that would also be pretty inefficient.

Jim