大家好 我有我的文件具有的.html extention一个问题,但我想,当brownser打开该文件进一步扩展了hidden.e.g file.html到文件。 先感谢隐藏扩展名在.htaccess
2
A
回答
5
在你.htaccess
文件中使用这样的:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
现在你可以使用像林家http://www.mysite.com/contact
而非http://www.mysite.com/contact.html
。
希望这会有所帮助!
0
您的链接必须是这样的
<a href="example">Example</a>
Instead of
<a href="example.php">Example</a>
然后添加到您的.htaccess文件
RewriteCond ^example example.php [L]
0
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-d
的RewriteCond%{ REQUEST_FILENAME}的.html -f
重写规则^(。*)$ $ 1.HTML
这一个是确定在一个网站的单一扩展。我在同一个网站中使用了多个扩展,例如index.html和contact.php。
我怎么能使用此代码?
1
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
例yoursite.com/wallpaper.html到yoursite.com/wallpaper/
相关问题
- 1. .htaccess隐藏扩展名和变量
- 2. 使用htaccess隐藏文件扩展名
- 3. 使用.htaccess隐藏扩展
- 4. 隐藏在.htaccess中的文件扩展名
- 5. 在.htaccess文件中隐藏文件扩展名(php)
- 6. 强制WWW并确保文件扩展名隐藏在HTACCESS中
- 7. Apache .htaccess隐藏.php和.html扩展
- 8. 隐藏PHP扩展与的.htaccess
- 9. htaccess隐藏html扩展和addThis插件
- 10. 在url中隐藏文件扩展名?
- 11. 在url中隐藏扩展名.php mod_rewrite
- 12. htaccess,如何使用gzip压缩+隐藏.html扩展名?
- 13. 如何隐藏扩展名和包含的文件夹.htaccess的
- 14. htaccess文件扩展名隐藏和传递url字符串
- 15. 的.htaccess隐藏扩展名,同时迫使WWW
- 16. .htaccess隐藏文件扩展名并强制结尾斜杠
- 17. htaccess的隐藏扩展名不允许ExpressionEngine登录
- 18. 如何使用.htaccess隐藏.php网址的扩展名?
- 19. .htaccess隐藏.php文件扩展名,显示/(斜杠)而不是
- 20. .htaccess更改根文件夹并隐藏.html/.php扩展名
- 21. 如何使用.htaccess隐藏文件扩展名+限制访问
- 22. .htaccess隐藏文件扩展名不工作(WampServer)
- 23. 隐藏文件扩展名是不工作的htaccess
- 24. 如何隐藏PHP文件扩展名而不使用.htaccess?
- 25. 如何隐藏.php文件扩展名,而无需使用.htaccess?
- 26. 隐藏扩展名和扩展名为重定向URL
- 27. 隐藏扩展url
- 28. Filebrowser隐藏扩展在VB6
- 29. 隐藏PHP扩展和隐藏子目录都在同一个网址在.htaccess
- 30. 隐藏文件扩展名是自
感谢,但问题是,他们表现出在浏览器中的联系人页面,但是当我在浏览器contact.html写到这里extentionshow直到刷新页面。 – user716987 2011-04-20 11:21:22
我读到contact.html,你已经失去了我。你在做什么? – ThisDarkTao 2011-04-20 11:30:59
制作一个页面contact.html并编写.htaccess并通过以上代码打开浏览器中的.htaccess.now文件,它们会显示您的联系人,但问题是,当您在浏览器中使用联系人页面编写.html时,但我想extention不会显示如果我写在浏览器中的.html extention然后页面没有想到这extention。看到这个链接http://www.myatlantainjurylawyer.com/ – user716987 2011-04-20 11:55:41