I have to make the URL of my site a SEO friendly URL and I tried some .htaccess code but it didn’t happen. currently the URL of my site is this:- https://www.sarkariresultz.net/postview.php?id=latest-jobs/sbi-specialist-officers-so-various-post-recruitment-2024.
But I want the URL of the site to be something like this:- https://www.sarkariresultz.net/postview.php?id=latest-jobs/sbi-specialist-officers-so-various-post-recruitment-2024.
RewriteEngine On
# Remove .php extension from URLs
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]
## hide .php extension snippet
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} s([^.]+).php [NC]
RewriteRule ^ %1 [R,L]
# Basic example to convert example.com/post/123 to example.com/postview.php?id=123
RewriteRule ^post/([0-9]+)$ postview.php?id=$1 [L,QSA]
Sonu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.