I want to ask you guys, how to change subpages names? Like when I created my website first page is index.html (when I wrote it in taskbar and enter this website it shows www.example) next is gallery.html but when I go to gallery it show www.example/gallery.html and I want to be like this www.example/gallery without .html or even www.example/g. Thanks for helping me out!
Asked
Active
Viewed 220 times
0
-
Well, it depends a lot of the time. Are you hosting it locally or on a server? – Trevor Jan 02 '15 at 19:39
-
Yes I have it on server right now – FuriousFamous Jan 02 '15 at 19:40
-
@Mikik here you go! http://stackoverflow.com/questions/5730092/how-to-remove-html-from-url – Trevor Jan 02 '15 at 19:41
-
Thanks ! I was not sure where to find it! Thanks a lot – FuriousFamous Jan 02 '15 at 19:42
1 Answers
0
Use this .htaccess
code. Rewrites www.myweb.com/test.php
to www.myweb.com/test
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^.*$ $0.php [L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.+)\.php$ $1 [L,R=301,NE]

Mardzis
- 760
- 1
- 8
- 21
-
If you can rewrite `test.html` to `/test`. Edit all `.php` in my code to `.html`. Accept my answer if I help :) – Mardzis Jan 02 '15 at 19:45
-