Hi everyone...
I am just geting to grips with htaccess RewriteRules

I have the following rule that redirects users to website.com/folder

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9]+)\/?$ /webstores/$1/ [L]

But the url is missing the trailing forward slash /
when I try and open php files in the directory, I get the 404 not found error message
when I add the trialing slash myself and open a php file, it opens as expected...

What am I missing....
Thanks

You might try this

RewriteCond %{REQUEST_URI} !(/$|\.) 
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L] 

Hi thanks for replying...
Would I add your suggestion to the existing file or replace it

Hi @pixelsoul...
Thats great that mate thanks...

That worked a treat....

Cheers!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.