Quantcast
Channel: How to remove php extension from pages except search results? - Webmasters Stack Exchange
Viewing all articles
Browse latest Browse all 2

How to remove php extension from pages except search results?

0
0

Using htaccess I have these php rules:

<IfModule mod_rewrite.c>Options +FollowSymLinks -MultiViews# Turn mod_rewrite onRewriteEngine OnRewriteBase /## don't touch /forum URIsRewriteRule ^forums/ - [L,NC]## hide .php extension snippet# To externally redirect /dir/foo.php to /dir/fooRewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]RewriteRule ^ %1 [R,L]# To internally forward /dir/foo to /dir/foo.phpRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME}.php -fRewriteRule ^(.*?)/?$ $1.php [L]# To remove www headerRewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]RewriteRule ^(.*)$ http://%1/$1 [L,R=301]</IfModule>

Everything is working, except if I do a search, the search results page is not showing the results because it is taking out the php extension. Example: search/?s=building where "building" is the term used. Generally, it should look like this: search.php?s=building

How do I tell htaccess that I only wanted to hide the php extensions of the pages except the results page?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images