I am using Opencart and I have some static pages also.
I don’t want to mess up opencart’s SEO options so is there a way to create clean URLs only for specific pages?
What I want is :
http://example.com/my-custom-page.php
to
http://example.com/my-custom-page
I am using standart htaccess file comes with opencart package
I have these lines:
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
2
Answers
If you wanted to remove the .php extension in your url just use
or this
If .html then you can do
RewriteRule ^([^.]+)$ $1.html [NC,L]
put the following code at main directory (root)
.htaccess
file :The code will remove my-custom-page.php extension and it would be my-custom-page regardless of its directory