htaccess rules for searches

Asked

Viewed 82 times

0

I am using the following htaccess code:

<IfModule mod_rewrite.c> 
RewriteEngine on 


# Include in the next line all folders to exclude
RewriteCond %{REQUEST_URI}  !(app/view/*|web/*) [NC]

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d   
RewriteRule ^(.*)$ index.php?url=$1 [PT,L] 
</IfModule>

I wish the url of a search to be accepted by it:

http://localhost/previdencia/admin/pesquisa?search=ouvidoria

How do I make it work?

1 answer

2


Use the [QSA, L] flags to use to read URI requests via GET and also to rewrite. You can see more details on this question: https://stackoverflow.com/questions/16468098/what-is-l-in-qsa-l-in-htaccess

Your code would look like this:

# Include in the next line all folders to exclude
RewriteCond %{REQUEST_URI}  !(app/view/*|web/*) [NC]

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d   
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] 
</IfModule>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.