Results 1 to 2 of 2
  1. #1

    modrewrite without explicit redirecting

    Hi, I have this as my .htaccess

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule !(index.php) http://domain.com/index.php?languageIndicator=lang_ar [L]
    </IfModule>

    It works in every way as desired.

    Any url, http://domain.com/whatever will show up http://domain.com/index.php

    From index.php then I can create php generated websites that take pics, whatever from database.

    However, I got an idea. What about if several domain names use the same index.php and the same database. So, it's like mirrors.

    If I put the same .htaccess in other domain name, I got something unexpected though.

    The url location actually change to http://domain.com/index.php?languageIndicator=lang_ar

    Also the content of
    PHP Code:
    echo 'Server:' $_SERVER['SERVER_NAME'] . "\n";
    echo 
    'Host:' $_SERVER['HTTP_HOST'] . "\n";
    echo 
    'Request:' $_SERVER['REQUEST_URI']; 
    also change to domain.com, and /index.php?languageIndicator=lang_ar


    I want an implicit redirect. Not an explicit redirect. To the outside world, people must think that they're indeed accessing http://otherdomainame.com/somepages and has no way to know that the page they're looking is http://domain.com/index.php?languageIndicator=lang_ar

    How can I do that?

    Of course, I can always copy index.php to all my domain names. But that's slow.

  2. #2
    Join Date
    Dec 2006
    Location
    Charlotte NC
    Posts
    155
    Rather than redirecting to a URL, you can also redirect to a local file on the server. This will allow redirection without using a specific domain.

    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule !(index.php) /var/www/path/to/domain.com/index.php
    </IfModule>
    Caro.net :: Engineered Hosting
    Engineered Hosting solutions including Cloud, Dedicated, Colocation, and Managed Services.

Posting Permissions

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