Karim230
Karim230

Reputation: 41

my website go in 404 page when i put this code in htaccess?

I need this

www.mydomain.com/apple
www.mydomain.com/banana
www.mydomain.com/mango
to
www.mydomain.com/search.php?q=apple
www.mydomain.com/search.php?q=banana
www.mydomain.com/search.php?q=mango

This is not working
My website go in 404 page
My .htaccess

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^(.*) search.php?q=$1

Upvotes: 2

Views: 32

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

Options +FollowSymLinks
RewriteEngine on
#If the request is not for an existent directory
RewriteCond %{REQUEST_FILENAME} !-d
#And file
RewriteCond %{REQUEST_FILENAME} !-f
#Then rewrite the request 
RewriteRule ^(.*)$ /search.php?q=$1

Upvotes: 1

Related Questions