1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

[NEED HELP] mod rewrite

Discussion in 'Apache' started by brainet, Jul 7, 2007.

  1. #1
    brainet, Jul 7, 2007 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Options +FollowSymLinks +Indexes
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^.]+)$ index.php?url=$1 [L]

    Then check the rest of the site if there is anything...it probably won't work unless you have something unique in the URL, like a fake directory or extension.
     
    Nintendo, Jul 7, 2007 IP
  3. brainet

    brainet Active Member

    Messages:
    1,383
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    90
    #3
    brainet, Jul 7, 2007 IP
  4. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #4
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !index\.php [NC]
    RewriteRule ^tes/(?:www\.)?([a-z0-9][a-z0-9\-]*[a-z0-9])\.([a-z]{2,4})$ tes/index.php?url=$1.$2 [L,NC]
     
    VimF, Jul 7, 2007 IP
  5. brainet

    brainet Active Member

    Messages:
    1,383
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    90
    #5
    nope still doesnt work. any other suggestion?

    ihave try this :
    RewriteRule ^(.*)\.(.*)$ index.php?url=$1.$2 [L]

    but still aint working, any others?

    and where should i put the .htaccess file? in the root or in the "tes/" folder
     
    brainet, Jul 7, 2007 IP
  6. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #6
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !index\.php [NC]
    RewriteRule ^([a-z,0-9][a-z,0-9,\-]*[a-z,0-9])\.([a-z]{2,4})$ index.php?url=$1.$2 [L,NC]
    RewriteRule ^www\.([a-z,0-9][a-z,0-9,\-]*[a-z,0-9])\.([a-z]{2,4})$ index.php?url=www.$1.$2 [L,NC]

    Put it in the "tes/" folder. If you want it to work at the root just move everything there.
     
    VimF, Jul 7, 2007 IP
    brainet likes this.
  7. brainet

    brainet Active Member

    Messages:
    1,383
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    90
    #7
    ok thanks its work now. give you + reputation
     
    brainet, Jul 7, 2007 IP
  8. brainet

    brainet Active Member

    Messages:
    1,383
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    90
    #8
    i still got some error. i cant run the script.
    this is form in "index.php:
    and when i click on submit button, nothing happens, what wrong? any solution?
     
    brainet, Jul 7, 2007 IP
  9. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #9
    Replace the old RewriteCond with this:

    RewriteCond %{REQUEST_URI} !\.php [NC]

    And use $_GET instead of $_POST:

    <form method="POST" action="results.php">
    <input type="text" name="url" value="<?php echo ($_GET['url']) ? htmlspecialchars($_GET['url']) : 'http://xoogie.net'; ?>" size="40" />
    <input type="submit" value="Submit" />
    </form>
     
    VimF, Jul 7, 2007 IP