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
    Regular Coder
    Join Date
    Mar 2005
    Posts
    156
    Thanks
    8
    Thanked 1 Time in 1 Post

    rewriterule not keeping url structure

    My RewriteRule is working in the sense of passing the variables, but it is not keeping the URL structure. It is changing it to the second half of the rule in the URL...

    PHP Code:
    RewriteRule ^computer-store/([^/]*)/([^/]*)/([^/]*)/([^/]*).htmlhttp://www.example.com/computer-store/?title=$1&_action=$2&id=$3&parent=$4 [L] 
    Example Link:
    PHP Code:
    http://www.example.com/computer-store/Alaska/main/1/0.html 
    Again, the link works in passing the variables, and the page gives me the proper results, but the URL after clicking the link is the following:

    PHP Code:
    http://www.example.com/computer-store/?title=Alaska&_action=main&id=1&parent=0 

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    1. This has nothing to do with PHP.
    2. It matches and performs perfectly for what you have provided. So what is the problem again?

    Rewriting works only one way, and that is Apache -> processor. When you create a link and provide it as a querystring, that is what you will get; rewrite will not rewrite the links on your web page.


  •  

    Posting Permissions

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