Hi,
The code at the bottom of this post works perfectly except for one thing. I want to be able to either add a trailing slash or make it so that the url can work with a trailing slash and without one. So:
www.mysite.com/paintings and
www.mysite.com/paintings/ would both work. As it stands right now, the trailing slash does not work no matter what I do. I have tried a few rewrite scripts that I have found, but the issue is that my url ends up not working, and it will read like: mysite.com/folder/mysite/html/paintings.php. The scripts that I have tried are basically reading the entire root folder on the server instead of just the HTML folder.
My second question is is there a way that I can rewrite all of the urls on my site without having to create new code inside the .htaccess file? For example, in the code below, if I add an orange.php page inside of my acrylics folder, I am going to have to paste:
Code:
RewriteRule ^artwork/([paintings]+)/([a-z]+)/([0-9]+) paintings/acrylics/orange.php?page=$3 [L]
RewriteRule ^artwork/([paintings]+)/([a-z]+)/([a-z]+) paintings/acrylics/orange.php?page=viewall [L]
into the .htaccess file, and so on, as I add new pages. That just seems like the wrong way to go about things, and the .htaccess file can get large fairly quickly if I have lots of pages.
Any help given is much appreciated. Thank you!
Code:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.xml -f
RewriteRule ^(.*)$ $1.xml
RewriteRule ^designs/([0-9]+) designs.php?page=$1 [L]
RewriteRule ^designs/([a-z]+) designs.php?page=viewall [L]
RewriteRule ^paintings/([0-9]+) paintings.php?page=$1 [L]
RewriteRule ^paintings/([a-z]+) paintings.php?page=viewall [L]
RewriteRule ^artwork/([paintings]+)/([a-z]+)/([0-9]+) paintings/acrylics/blue.php?page=$3 [L]
RewriteRule ^artwork/([paintings]+)/([a-z]+)/([a-z]+) paintings/acrylics/blue.php?page=viewall [L]
RewriteRule ^artwork/([women]+)/([a-z]+)/([0-9]+) artwork/oils/red.php?page=$3 [L]
RewriteRule ^artwork/([women]+)/([a-z]+)/([a-z]+) artwork/oils/red.php?page=viewall [L]