I have a website that I have made. I am using friendly urls and I want to force use those in the URL bar. Current htaccess is

#Options +FollowSymLinks

RewriteEngine On
RewriteBase /
RewriteRule ^(gallery|upload|verify|contact|about)$ $1/ [R]
RewriteRule ^(gallery|upload|verify|contact|about)/$ $1.php [NC]

RewriteRule ^view/?$ view.php [NC]
RewriteRule ^view/(molly|ms|es|misc)$ view/$1/ [R]
RewriteRule ^view/(molly|ms|es|misc)/$ view.php?folder=$1 [NC]
RewriteRule ^view/(molly|ms|es|misc)/(\d+)/?$ view.php?folder=$1&image=$2 [L,NC]

RewriteRule ^gallery/(molly|ms|es|misc)$ gallery/$1/ [R]
RewriteRule ^gallery/(molly|ms|es|misc)/$ gallery.php?folder=$1 [NC]
RewriteRule ^gallery/(molly|ms|es|misc)/(\d+)/?$ gallery.php?folder=$1&page=$2 [L,NC]

I want gallery.php?folder=ms&page=1 to be forced to use gallery/ms/1/. I tried to do a Rewriterul redirect with [R] but that causes a redirect loop. Should I put a dummy variable in so it doesn't loop?

I would recommend to use a single line that handles a missing slash, and use [R=301] for your redirects (it's not temporary). Then, you can figure out more easily which parts work and don't work.

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.