Reputation: 1705
I want to re-write the following url from:
www.phcc.com/reports/caseFullDtlByCaseSno.php?case_sno=1
To
http://www.phcc.com/reports/1/caseFullDtlByCaseSno.html
For this i have written the following .htaccess file inside the reports directory which is the sub-directory of the website root:
RewriteEngine on
RewriteBase /reports/
RewriteRule ^(.*)/(\d+)\.php $1=case_sno&$2.html [NL,L]
RewriteRule ^(.*)/(\d+)\.html $1=case_sno&$2.php [L]
but it does not complete the request as i need it. What should i do?
Upvotes: 1
Views: 74
Reputation: 7476
Try with below, I am assuming the html files are not existent.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\d]+)/([\w-]+)\.html$ $2.php?case_sno=$1 [L]
Upvotes: 1