.htaccess not working

Hi. I have recently been switching over the site to use php, but have had some issues trying to rename urls with the .htaccess file. Nothing seems to have an affect. I have placed the file in the root folder of the website folder. I would like to change links such as this one:




Here is my .htaccess file:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.$ - [NC,L]
RewriteRule ^(.
)$ index.php?page=$1

Thank you

Each RewriteCond needs to be on a separate line, e.g.

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

That being said, you can express this using a single rule by negating the conditions:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?action=$1

Thank you. I tried that, but still had no results. I’ve never used an htaccess file before. Possibly there is something simple I haven’t tried?

Oh, wait. Changed “page=$1” to “action=$1” in my example — try again now? It helps if you use the right parameter name. :slight_smile:

Updated my code. Still no result.

Never mind. Just realized how this works. I thought going to the link http://polarischurch.com/?action=pictures would redirect to http://polarischurch.com/pictures when it is the reverse. Thanks for the help!