regex - Apache mod_rewrite encoded URLs -


I am working on a webpage that takes the URL as a parameter, and it is easily indexed by search engines. Would like to do. One requirement is that each URL appears as a directory.

My script is in the format:

  myscript? Url = & lt; A url & gt; And page = 1  

I have to redirect to see something like this:

  lookup / & lt; A url & gt; / Page: 1 /  

The URL is causing me problems in the future ... I just "see / after" and anything after the "/ page" Want to tell mod_rewrite to choose Of course, nothing can be as easy as it can be.

It has to be rewritten because it is now:

  RewriteEngine on RewriteRule ^ / lookup /(.+)/ Page: ([0-9] + / ( $) + / Myscript? Url = $ 1 & amp; page = $ 2 [L]  

This works very well, besides, when the URL is properly encoded "Www. Take the example of google.com/finance "When I put these URLs in my browser's address bar, this is what happens:

  # this lookup / www.google.com / finance / Page: 1 / # It does not work. URL is cut before? Lookup / www.google.com / finance? Foo = bar / page: 1 / # Write does not match! Lookup / www.google.com% 2Finance / page: 1 /  

I'm at a loss as to how to do this ... (not. ) Select anything ? Do I need to tell mod_rewrite to ignore the query parameters in any way?

Try it:

  Riwait Kandn% {THE_REQUEST} ^ GET \ / lookup / ([^ \ s] +) / page: ( [0-9] +) / [? \ S] RewriteRule ^ / lookup / / myscript? Url =% 1 & amp; Page =% 2 [L]  

But it can be really guessed where it might end, instead the properly embedded URL should consider the encoding. Therefore, /lookup/www.google.com/finance?foo=bar/page:1/ must be at least /lookup/www.google.com/finance%3Ffoo=bar/page Should: 1 / hence ? URI is part of the path and not the indicator for the query.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -