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?

6 Years
Discussion Span
Last Post by twiss

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.