I think this was supposed to work:


RewriteEngine On
RewriteRule ^(.*)\.zajfe\.org$  redirect.php?url=$1   [L]

Are you sure it doesn't? If it doesn't then meas they

 1. don't have mod_rewrite (phphinfo shows you the modules loaded)
 2. don't allow .htaccess to override httpd.conf rules.

Also read about mod_rewrite, right in the manual there are a few
examples to do what you need. Always if you have it loaded.

Maxim Maletsky

-----Original Message-----
From: affixcom [mailto:[EMAIL PROTECTED]] 
Sent: marted́ 2 ottobre 2001 20.54
Subject: [PHP] Htaccess / regex / php I dont know why it won't work

I have a website hosted on a cobalt server with my own domain, but not
my own IP. I have a full access to my root web, but not higher (means
can't change any *.conf files). My domain is "wildcarded" I want to be
able to redirect based on the entry, IE if a user types
http://hello.mydomain.com he will go to http://mydomain.com/hello=20 if
a user types http://another.mydomain.com he will go to

The redirect method of apache doesn't work because I leanred that that
is based on an absolute path from the server I tried php scripts that
read the subdomain and use it in the header function but it won't work.
I came to the conclusion after a lot of tests that rewriterule from the
htaccess is the the best.

htaccess script: (doesn't work)
RewriteEngine On
RewriteRule ^(.*)\.zajfe\.org$  redirect.php?url=$1   [L]
connected to the page redirect.php where
PHP script: (doesn't work)
$domain = "yourdomain.com";
$default_page = "main.shtml";
$underdomaene = $HTTP_HOST;
$underdomaene = eregi_replace("\.".$domain, "", $underdomaene);
$underdomaene = eregi_replace("www\.", "", $underdomaene); $underdomaene
= strtolower($underdomaene); if (is_dir("$DOCUMENT_ROOT/$underdomaene"))
   header("Location: http://$domain/$underdomaene";);
else {
 if (!$REQUEST_URI || $REQUEST_URI == "/") {
 else {
  header("Location: http://$domain$REQUEST_URI";);

I am open to ANY suggestion, CGI / ASP / PHP / SSI (it is all on the
server), I want it to work



PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to