隐藏文件扩展名的网址是什么? [英] hide file name extensions in url?
问题描述
一些能帮助我,请我想隐藏我的网站的URL文件扩展名。
这样一个例子是 http://www.mysite.com/home.php http://www.mysite.com/control.php
将改为显示为 http://www.mysite.com/home http://www.mysite.com/control
我一直在寻找到这一点,并发现了这个code这似乎隐藏URL中的文件扩展名,但现在我的链接无法正常工作,并即时得到一个404错误。我想我需要修改我的网站链接路径或类似的东西。
有人可以告诉我什么,我需要做的拜托,这里是用我的.htaccess中的code IM:
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{REQUEST_FILENAME} \ PHP -f
重写规则^([^ /] +)/ $ $ 1.PHP
的RewriteCond%{THE_REQUEST} ^ [AZ] + \ /([^ /] + /)* [^] + \。PHP(\?[^ \] *)?\ HTTP /
重写规则^(([^ /] + /)* [^。] +)\。PHP $ http://www.mysite.com/$1 [R = 301,L]
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{REQUEST_URI}!(\ [A-ZA-Z0-9] {1,5} | /)$
重写规则(。*)$ http://www.mysite.com/$1/ [R = 301,L]
谷歌可以叠前帮助:)
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{REQUEST_FILENAME} \。HTML -f
重写规则^([^ /] +)/ $ $ 1.HTML
#强制斜线添加
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{REQUEST_URI}!(\ [A-ZA-Z0-9] {1,5} | /)$
重写规则(。*)/ $ 1 / [R = 301,L]
http://eisabainyo.net/weblog / 2007/08/19 /删除文件 - 扩展 - 通过-htaccess的/ 此外LOOKAT 制作重写规则删除扩展名为.php?
can some help me please i am wanting to hide the file name extension in the url of my site.
so an example would be http://www.mysite.com/home.php http://www.mysite.com/control.php
would instead show as http://www.mysite.com/home http://www.mysite.com/control
i have been looking into this and found this code which seems to hide the file name extension in the url but now my links wont work and im getting a 404 error. i think that i need to amend my site link paths or something like that.
can someone show me what i need to do please, here's the code im using in my .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.]+\.php(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.php$ http://www.mysite.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ http://www.mysite.com/$1/ [R=301,L]
Google can help before stack :)
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^([^/]+)/$ $1.html
# Forces a trailing slash to be added
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
http://eisabainyo.net/weblog/2007/08/19/removing-file-extension-via-htaccess/ Also lookat Making a rewriterule remove .php extension?
这篇关于隐藏文件扩展名的网址是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!