I have a url as following
http://example.com/post/post-title/1
so it is /file-name/post-name/page-number
so i want the 1st page to display without page number.
http://example.com/post/post-title
and then from second page
http://example.com/post/post-title/2
My htaccess code is.
RewriteRule post/(.*)/([0-9]+)$ post.php?id=$1&page=$2 [NC,L]
Is there any way to do this? Applicate your help.
You can have 2 rules for this:
Options -MultiViews
RewriteEngine On
# default rule for page #1
RewriteRule post/([\w-]+)/?$ post.php?id=$1&page=1 [NC,L,QSA]
# to handle URLs with specific page #
RewriteRule post/([\w-]+)/(\d+)/?$ post.php?id=$1&page=$2 [NC,L,QSA]