Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    41
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Mod rewrite - using server URL

    I'm trying to rewrite a wierd URL i haven't done before i think its conflicting with the curly character.

    The url is:

    http://ftp2.domains.net/~insurance/i...ounty=cheshire

    I wanted to turn this url, using .htaccess into SEO friendly such as:

    http://ftp2.domains.net/~insurance/r...rance/cheshire

    I have tried counless menthod to achive this with no luck.

    I have tryed this and others.

    RewriteRule /(.*)/$ /\~insurance/index.php?insurancetype=$1

    Thanks the help. much appreciated.

  • #2
    120
    120 is offline
    Regular Coder
    Join Date
    Nov 2009
    Location
    UK
    Posts
    105
    Thanks
    6
    Thanked 15 Times in 15 Posts
    The symbol is called 'Tilde' (usually pronounced 'tilda') and I would wonder why you are escaping it in the substitution. Now in the match would be something different :-)

    Basically what you have there won't work. Say you call up
    Code:
    blah.net/~insurance/index.php?insurancetype=restaurants-insurance&county=cheshire
    Your rewrite - if it worked -would (I think) try and translate that URL to something like this:
    Code:
    blah.net/\~insurance/index.php?insurancetype=blah.net/~insurance/index.php?insurancetype=restaurants-insurance&county=cheshire
    The backslash would probably result in a 404 (or even a 500 internal) error.

    Depending on how many querystring elements you have I would look at using RewriteCond to do the matching making use of %{QUERY_STRING} and back references.

    This will give you a pointer: http://www.simonecarletti.com/blog/2...-query-string/
    There is always plenty of idol work for the devils hands to do
    Registered Linux User 475075 : Project Honeypot


  •  

    Posting Permissions

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