matthutaff
asked on
RewriteRule problem adding extension
I currently have the following .htaccess file that mod.rewrites a query to something resembling a static URL:
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /about/campus/
RewriteRule ^([^.]+)$ profile.php?country=$1
</IfModule>
This allows for campus information about Canada to appear as /about/campus/canada, but I'd like to add the PHP extension to the back of the URL. When I place .php in the RewriteRule, however, it doesn't work unless I add [QSA] to the end, but then all PHP files in that direct redirect to profile.php.
I am a novice at mod.rewrite, any help is appreciated.
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /about/campus/
RewriteRule ^([^.]+)$ profile.php?country=$1
</IfModule>
This allows for campus information about Canada to appear as /about/campus/canada, but I'd like to add the PHP extension to the back of the URL. When I place .php in the RewriteRule, however, it doesn't work unless I add [QSA] to the end, but then all PHP files in that direct redirect to profile.php.
I am a novice at mod.rewrite, any help is appreciated.
ASKER
It should (I've tried that solution), but when I use that RewriteRule, it passes "profile" as the query string.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ding ding ding! Works great!
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /about/campus/
RewriteRule ^([^.]+)\.php$ profile.php?country=$1
</IfModule>