Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2005
    Posts
    533

    mod_rewrite question

    Hello,

    I want define a mod_rewrite for my program,
    we should have this url :
    whois.domain.com/domain.com

    and this address should run this program: whois.domain.com/whois.php?domain=<domain_name>

    whois is a subdomain and this subdomin have a folder in /home/domain/public_html/whois

    How can I define a mod_rewrite for this request ?

  2. #2

  3. #3
    Join Date
    Mar 2005
    Posts
    533
    Thanks,

    I use this code but when I trying to use whois.domain.com/google.com I get thismessage:

    Not Found

    The requested URL /google.com was not found on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  4. #4
    Join Date
    Apr 2009
    Location
    Bangladesh
    Posts
    406
    i am not so good at url rewriting yet, but try this. it might work
    Code:
    RewriteEngine On
    
    RewriteCond %{SCRIPT_FILENAME} .*\.(.*+)/?$
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteRule ^([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-.]+)/?$ whois.php?domain=$1.$2 [L,NC]

  5. #5
    Join Date
    Mar 2005
    Posts
    533
    Thanks,

    I get that message again :-(

  6. #6
    Join Date
    Dec 2002
    Location
    Sibiu, Romania
    Posts
    229
    Try this basic code to see if the rules above are the problem or if there is something else

    Code:
    RewriteRule ^(.*)$ whois.php?domain=$1
    you you get the same error maybe you don't have enabled mod_rewrite or you didn't upload the htaccess file in the /whois folder

    PS. I just tried the above rules, first one it show me the error about File /google.com not found and the second one generated an Internal Server Error.

  7. #7
    Join Date
    Mar 2005
    Posts
    533
    I can solve this problem myself with my friends guides.

    I use this code :

    Code:
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/?$ whois.php?domain=$1 [L,NC]

    this work for me.

    Thanks

Similar Threads

  1. mod_rewrite question
    By computerwiz3491 in forum Programming Discussion
    Replies: 3
    Last Post: 06-17-2008, 11:09 PM
  2. another mod_rewrite question
    By Blueheaven in forum Programming Discussion
    Replies: 5
    Last Post: 02-15-2005, 07:00 PM
  3. mod_rewrite question
    By freakie in forum Hosting Security and Technology
    Replies: 0
    Last Post: 12-30-2004, 06:13 AM
  4. mod_rewrite question
    By Quickcess in forum Hosting Security and Technology
    Replies: 0
    Last Post: 04-18-2004, 08:27 AM
  5. mod_rewrite question
    By TimS in forum Programming Discussion
    Replies: 3
    Last Post: 04-15-2004, 05:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •