I have a .htaccess file that creates a SEO URL. For example, let's say the ugly URL is: example.com/stories?url=hello-world&page=5 the URL becomes example.com/stories/hello-world/5
This works perfectly, but for the first page I want the URL to not display the page number. For example, I want a URL like this example.com/stories/hello-world/1 to be example.com/stories/hello-world How do I do this?
Current .htaccess
RewriteEngine On
RewriteBase /stories/
RewriteCond %{THE_REQUEST} /\?url=([^&\s]+)&page=([0-9]+) [NC]
RewriteRule ^ %1/%2? [L,R=302]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?url=$1&page=$2 [L,QSA]