如何使用.htaccess在地址栏中隐藏php文件名

编程入门 行业动态 更新时间:2024-10-22 17:19:21
本文介绍了如何使用.htaccess在地址栏中隐藏php文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

# CASE SENSITIVE METHOD Options -Indexes # quick custom error "document".. ErrorDocument 404 "<html><head><title>NO!</title></head><body><h2><tt>There is nothing here.. go away quickly!</tt></h2></body></html> Options +FollowSymlinks RewriteEngine on RedirectMatch /$ 192.168.1.25/shrineyog/index.html # Pass Through the empty request (to be handled as DirectoryIndex) RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /?\ HTTP RewriteRule .? - [PT] # If index or index.php requested, strip and redirect RewriteCond %{THE_REQUEST} index(\.php)? RewriteRule ^index(\.php)?$ www.example/ [R=301,L] # Remove PHP extension from links if NOT subrequest RewriteRule ^(.+)\.php$ $1 [R=301,NS] # Serve PHP extension from links RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.+)$ /$1.php [L]

i使用此代码。但是它无法正常工作。请更正此代码或者给出一些其他的代码 添加了代码块格式[/ Edit]

i use this code.but its not work properly.pls correct this code or give some other code Code block formatting added[/Edit]

推荐答案

http ://192.168.1.25/shrineyog/index.html #传递空请求(作为DirectoryIndex处理) RewriteCond%{THE_REQUEST} ^ [AZ] {3,9 } \ /?\ HTTP RewriteRule。? - [PT] #如果请求索引或index.php,请删除并重定向 RewriteCond%{THE_REQUEST}索引(\.php)? RewriteRule ^ index(\.php)? 192.168.1.25/shrineyog/index.html # Pass Through the empty request (to be handled as DirectoryIndex) RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /?\ HTTP RewriteRule .? - [PT] # If index or index.php requested, strip and redirect RewriteCond %{THE_REQUEST} index(\.php)? RewriteRule ^index(\.php)?

www.example/ [R = 301,L] #如果不是子请求,则从链接中删除PHP扩展名 RewriteRule ^(。+)\.php www.example/ [R=301,L] # Remove PHP extension from links if NOT subrequest RewriteRule ^(.+)\.php

更多推荐

如何使用.htaccess在地址栏中隐藏php文件名

本文发布于:2023-10-31 18:58:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546984.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件名   如何使用   栏中   地址   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!