Hello all. I have a question about manipulating the .htaccess file generated from couchcms...
First of all, I have created a website for a client (not posting URL for security reasons), and there are many clonable pages within the website. There is a clonable template page.php that handles the websites "pages", and populates the navigation menu. I've been learning more and more about CouchCMS, and I recently realized there are some things I could have done differently when creating this website... I did not use index.php as the clonable template for my "page creator", and I think could have utilized custom routes for the home/landing pages having used index.php.
With that said, I'm searching for a way to further simplify the page URLs for the website. With Pretty URLs activated, each of the pages created from the page.php template has a URL like this: /page/admissions/tuition-fees.html. I'm trying to remove the 'page/' part of those URLs.
I want to know if I can edit the following section of the Couch generated .htaccess file...
#page.php
RewriteRule ^page$ "$0/" [R=301,L,QSA]
RewriteRule ^page/$ page.php [L,QSA]
RewriteRule ^page/.*?([^\.\/]*)\.html$ page.php?pname=$1 [L,QSA]
RewriteRule ^page/([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ page.php?d=$1$2$3 [L,QSA]
RewriteRule ^page/[^\.]*?([^/\.]*)/$ page.php?fname=$1 [L,QSA]
RewriteRule ^page/[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]
If I just delete the "page/" text after ^, will that mask the template name in the URL? Would look like this...
#page.php
RewriteRule ^$ "$0/" [R=301,L,QSA]
RewriteRule ^$ page.php [L,QSA]
RewriteRule ^.*?([^\.\/]*)\.html$ page.php?pname=$1 [L,QSA]
RewriteRule ^([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ page.php?d=$1$2$3 [L,QSA]
RewriteRule ^[^\.]*?([^/\.]*)/$ page.php?fname=$1 [L,QSA]
RewriteRule ^[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]
Not sure if it's that simple of a fix or not. Not something I want to go messing with without getting some help. Measure twice, cut once.
I also want to know if I can remove the .html part at the end.
Sam
First of all, I have created a website for a client (not posting URL for security reasons), and there are many clonable pages within the website. There is a clonable template page.php that handles the websites "pages", and populates the navigation menu. I've been learning more and more about CouchCMS, and I recently realized there are some things I could have done differently when creating this website... I did not use index.php as the clonable template for my "page creator", and I think could have utilized custom routes for the home/landing pages having used index.php.
With that said, I'm searching for a way to further simplify the page URLs for the website. With Pretty URLs activated, each of the pages created from the page.php template has a URL like this: /page/admissions/tuition-fees.html. I'm trying to remove the 'page/' part of those URLs.
I want to know if I can edit the following section of the Couch generated .htaccess file...
#page.php
RewriteRule ^page$ "$0/" [R=301,L,QSA]
RewriteRule ^page/$ page.php [L,QSA]
RewriteRule ^page/.*?([^\.\/]*)\.html$ page.php?pname=$1 [L,QSA]
RewriteRule ^page/([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ page.php?d=$1$2$3 [L,QSA]
RewriteRule ^page/[^\.]*?([^/\.]*)/$ page.php?fname=$1 [L,QSA]
RewriteRule ^page/[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]
If I just delete the "page/" text after ^, will that mask the template name in the URL? Would look like this...
#page.php
RewriteRule ^$ "$0/" [R=301,L,QSA]
RewriteRule ^$ page.php [L,QSA]
RewriteRule ^.*?([^\.\/]*)\.html$ page.php?pname=$1 [L,QSA]
RewriteRule ^([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ page.php?d=$1$2$3 [L,QSA]
RewriteRule ^[^\.]*?([^/\.]*)/$ page.php?fname=$1 [L,QSA]
RewriteRule ^[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]
Not sure if it's that simple of a fix or not. Not something I want to go messing with without getting some help. Measure twice, cut once.
I also want to know if I can remove the .html part at the end.
Sam