1
votes

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...

3

3 Answers

1
votes

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

0
votes

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

0
votes
<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>