I am creating a CMS in which there are three types of rendering pages:
1 - https://test-site.org/whatever-title
2 - https://test-site.org/test-page.php
3 - https://test-site.org/category/whatever-category
Originally I only had the first two and the below htaccess
work fine
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?title=$1 [QSA,L]
RewriteCond %{HTTP_HOST} test\.org [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.test.org/$1 [R,L]
However, when I added the third (category) with the rewrite rule for the third url type htaccess does not recognize the third url type but still sees and renders the first two correctly:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?title=$1 [QSA,L]
RewriteRule ^category/(.*)$ category.php?title=$1 [QSA,L]
RewriteCond %{HTTP_HOST} s8w\.org [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.s8w.org/$1 [R,L]
If I swap positions for RewriteRule ^(.*)$ index.php?title=$1 [QSA,L]
and RewriteRule ^category/(.*)$ category.php?title=$1 [QSA,L]
htaccess only recognizes the second and third url types.
I tried the below code which recognizes the first and second url types
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?title=$1 [QSA,L]
RewriteRule ^category/(.*)$ category.php?title=$1 [QSA,L]
RewriteCond %{HTTP_HOST} s8w\.org [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.s8w.org/$1 [R,L]
but throws the following error on the third url type:
[an error occurred while processing this directive]
I am self-taught and have no idea as to why the code doesn't work... Your assistance is much appreciated.