Save your .htaccess
inside public_html
dir with following code :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^search/(.*)$ search/index.php?q=$1 [L,QSA]
Question
I have a url rewrite working, but I am unsure how I get it so that it is only applicable to the index page of my search folder.
I am using the following code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?)/?$ /search/index.php?q=$1 [L,QSA]
With the following folder structure:
/
/public_html
/search
-index.php (inside search dir)
When I use my above url rewrite I have the following output:
http://blah.com/home/
The only issue is that instead of redirecting to my home folder it goes to the search page and runs a search for home.
My desired output would be:
http://blah.com/search/query
where query is what I am actually searching for.
My current php code inside my search directory index.php:
include('../secure.php');
$search = $_GET['q'];
How do I get it so that the rewrite only happens on the index.php page of my search folder?
No correct solution
OTHER TIPS
Save your .htaccess
inside public_html
dir with following code :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^search/(.*)$ search/index.php?q=$1 [L,QSA]