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.

Problem With My Rewriterule

Discussion in 'PHP' started by jeddiko, Jan 23, 2013.

  1. #1
    Problem with my rewriteRule

    Hi again,

    I have problem with running my info.php

    It starts before the program runs at the .htaccess file ...


    I get 2 kinds of links coming to my server.

    This kind:

    1)
    villa-rent-siberia.example.com

    Which OK as I have this code in my htaccess file redirect it:

    RewriteCond %{HTTP_HOST} ^(.+).example.com [NC]
    RewriteCond %{HTTP_HOST} !=www.example.com [NC]
    RewriteRule ^.*$ http://example.com/help.php?a=%1 [NC,QSA,L]

    Now the other type looks more complex - it looks like this:

    2)
    villa-rent-siberia.example.com/17-vacationsinsiberia.html

    Actually it's not more complicated because it contains the record no. 17

    But I need to process this type before the first (1) because otherwise it will generate the wrong page.

    But I am not sure how to this.

    I have tried this:

    Code:
    Options +SymLinksifOwnerMatch
    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^(.+).example.com [NC]
    RewriteCond %{HTTP_HOST} !=www.example.com [NC]
    RewriteRule ^[\.0-9,-a-z]+\.example.com/([0-9]+)+[\.0-9,-a-z]+\.html$ http://example.com/info.php?a=%1 [NC,QSA,L]

    RewriteCond %{HTTP_HOST} ^(.+).example.com [NC]
    RewriteCond %{HTTP_HOST} !=www.example.com [NC]
    RewriteRule ^.*$ http://example.com/help.php?a=%1 [NC,QSA,L]
    Unfortunately that's not working for long url,
    info.php doesn't run, only help.php and it returns the wrong page.

    How can I get the info.php to run by extracting that no. 17 ?

    thanks for any help.



    .

    __________________
     
    jeddiko, Jan 23, 2013 IP