What I'm trying to accomplish is to have people who go: http://www.example.com/ $ SEARCH-QUERY / $ PAGE-NUMBER to redirect to search.php? query = SEARCH-QUERY & page = PAGE-NUMBER
I just figured out how to install nginx and configure php-fpm, mysql and all, but now I'm a bit confused by the rewritings. Here is what I have that does not work correctly:
The PHP script will automatically take it to the first page if a page request is not sent with it, I also had to follow two rewrite rules, because I could not figure out how to implement it on one line, so that it could have it with a trailing slash and without her.
rewrite ^/search/(.*)$ /search.php?query=$1; rewrite ^/search/(.*)$/ /search.php?query=$1;
and then for items viewed with paginated results
rewrite ^/search/(.*)/(.*)$ /search.php?query=$1&page=$2; rewrite ^/search/(.*)/(.*)$/ /search.php?query=$1&page=$2;
If anyone could help, I would really appreciate it!
source share