Reputation: 21
I want to make this URL clean: news.php?post=13 but when I tried to use this RewriteRule:
RewriteRule ^(news)\/([0-9]+)\/?$ news.php?post=$2
It only shows the news page, no post content. It has been bugging me for the past 2 days, and I can`t figure it out. Can someone help me with this?
Here's the entire Htaccess
RewriteEngine on RewriteRule ^(news)\/([0-9]+)\/?$ news.php?post=$1 RewriteRule ^(verify)/(.*)/([a-zA-Z0-9_-]+)$ validate_account.php?usr=$2&hash=$3 [QSA,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php
Upvotes: 0
Views: 326
Reputation: 1
Try this method:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^news/([0-9]+)\/?$ news.php?post=$1
Upvotes: 0
Reputation: 309
Try this config:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^news/([0-9]+)\/?$ news.php?post=$1
RewriteRule ^verify/(.*)/([a-zA-Z0-9_-]+)$ validate_account.php?usr=$1&hash=$2 [QSA,L]
RewriteRule ^(.*)$ $1.php
Upvotes: 1