0

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

Purvik Dhorajiya
  • 4,662
  • 3
  • 34
  • 43

3 Answers3

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

use $1

turson
  • 421
  • 2
  • 9
1

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
Ruben
  • 319
  • 2
  • 14
0

Try this method:

RewriteEngine On

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

RewriteRule ^news/([0-9]+)\/?$ news.php?post=$1
Adil B
  • 14,635
  • 11
  • 60
  • 78
Boobalan
  • 1
  • 1