SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist tangledman's Avatar
    Join Date
    Sep 2005
    Location
    Puerto de Mazarron, Murcia, Spain
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Slightly more complex .htaccess

    Hello Everyone.

    I want to include the location name in my links whilst using the location id to select


    http://www.spanishpropertymagazine.c...n/6359492.html

    http://www.spanishpropertymagazine.com/http://www.spanishpropertymagazine.com/location/6359492.html

    I currently have this:
    PHP Code:
    #Rewrite page location
    RewriteRule  ^location/([0-9]+).html$ /?get_action=location&location_id=$[L
    I tried this
    PHP Code:
    #Rewrite page location
    RewriteRule  ^location/([0-9]+)_([A-Za-z_]+).html$ /?get_action=location&location_id=$[L
    But "no funciona", as they say in Spain.

  2. #2
    SitePoint Member
    Join Date
    Feb 2004
    Location
    Kathmandu, Nepal
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is one solution to your problem I think: bytes.com/topic/apache/answers/570642-apache-mod-rewrite-multiple-variables

  3. #3
    SitePoint Evangelist tangledman's Avatar
    Join Date
    Sep 2005
    Location
    Puerto de Mazarron, Murcia, Spain
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not really

    there is no second variable. It's just some text that could be anyting.

  4. #4
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "anything" represented by a dot (.) in regular expressions.
    By the way, a dot before "html" must be escaped with a slash (\)

  5. #5
    SitePoint Evangelist tangledman's Avatar
    Join Date
    Sep 2005
    Location
    Puerto de Mazarron, Murcia, Spain
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thankyou Mr Shrapnel

  6. #6
    SitePoint Evangelist tangledman's Avatar
    Join Date
    Sep 2005
    Location
    Puerto de Mazarron, Murcia, Spain
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is a dot any single character?

  7. #7
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes
    so .+\.html would match an7y# thi:::ng.html
    I believe.

  8. #8
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Shrapnel_N5 View Post
    yes
    so .+\.html would match an7y# thi:::ng.html
    I believe.
    It doesn't match ".html" since that has no characters before .html, and you specified .+ (+ meaning "repeat this sequence 1 or more times", the sequence being "." in this case)
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy


Bookmarks

Posting Permissions

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