0
votes

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

3

3 Answers

1
votes
RewriteRule ^(news)\/([0-9]+)\/?$ news.php?post=$2

use $1

1
votes

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
0
votes

Try this method:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f

RewriteRule ^news/([0-9]+)\/?$ news.php?post=$1