samedi 3 octobre 2020

How to add trailing slash in every URL?

i'm creating a dynamic PHP Blog site, where i have 2 type of url, in where one is having trailing slash and another one is no trailing slash. i want to create trailing slash in each every single url.

this below url is working properly trailing slash at the end...

http://example.com/category/title-of-the-article/

When i navigate to category it's no trailing slash i want to make trailing slash at the end

http://example.com/category

i want

http://example.com/category/

htaccess code

RewriteEngine On
RewriteBase /

RewriteRule ^home index.php [NC,L]

RewriteRule ^([0-9a-zA-Z]+)$ archive.php?category=$1 [NC,L] 

RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+) post.php?category=$1&url=$2 [NC,L]

In above htaccess code post.php is working fine.... article.php is not working.

please help me to make it possible....




Aucun commentaire:

Enregistrer un commentaire