Reputation: 253
i have a htaccess file which redirectes all the requests to index.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* ./index.php
My question is i would like to make a redirect to folder which doesn't exist and it should not affect the present htaccess redirects to index.php. since it is linked to entire website
for eg
domain.com/search=kannan&id=21
to
domain.com/kannan
I just need a way to allow only this request and everything else goes to index.php, any ideas...
Upvotes: 1
Views: 693
Reputation: 409
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /public/$1
#RewriteRule ^ index.php [L]
</IfModule>
Upvotes: 0
Reputation: 3765
i suggest you to pass id through form . Means use Form post method to pass id then you only need to have 'domain.com/kannan' in url and id will passed as post
Use similar type of code as below -
<form method="post" action="domain.com/kannan">
<input type="hidden" value="21" name="id" />
</form>
In this way form will be posted to domain.com/kannan with id = 21 and url will be domain.com/kannan
Upvotes: 0
Reputation: 1806
You could use a condition to capture requests that match a specific pattern, like:
RewriteCond %{REQUEST_URI} ^domain.com/search(.+)$
Then do your rewrite. Or: http://www.google.com/search?q=htaccess+query+string+rewrite
Upvotes: 1