Reputation: 9
After looking a lot into stackoverflow i'm not able to figure it out. I have a website with the following structure
index.php
contact.php
about.html
forum(dir)
- index.php
- thread.php
What i want my htaccess to do
www.domain.com/contact/
& www.domain.com/about/
www.domain.com/forum/thread/10004000/
instead of www.domain.com/forum/thread?id=10004000
I'm not sure how to figure it out. I was able to remove the extensions but failed in the /
"forward slash" part
This is my .htaccess part
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]
Upvotes: 0
Views: 130
Reputation: 429
Try below code to remove php extention , same for html you can added
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule ^forum/thread/(.+) /forum/thread?id=$1 [L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]
Upvotes: 0