Reputation: 583
I have been searching on the Internet for quite awhile now and I can't seem to find a working htaccess for my website. I am using a news CMS called CuteNews and they have a function that allows for URL rewrites. However, the URL rewrites caused the news pages to become .html as compared to all my other content pages which ends with a .php.
Instead of forcing the .html to .php or vice versa, I intend to remove both the .php and .html extension from the URL. However it can't work despite me putting a few different htaccess that other people had shown in the Internet.
Now, I am really a complete newbie at htaccess because I only have a very limited knowledge about it.
This is the .htaccess that CuteNews generates once I activate the URL rewrite functions,
# --- CUTENEWS[ST]
RewriteEngine ON
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /cms/show_news.php?cn_rewrite_url=$1 [L]
# --- CUTENEWS[ED]
Can anyone guide me along or something on removing the .html generated by this .htaccess as well as to remove the .php from my other content pages? Thanks.
Upvotes: 0
Views: 704
Reputation: 4249
To remove the .php or .html extension add the 2 last lines of this .htaccess extract in your htaccess file :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^([^\.]+)$ $1.html [NC,L]
Upvotes: 1