简体   繁体   English

htaccess URL重写文件是否视为文件夹?

[英]htaccess URL rewrite file treat as folder?

Are there any possibility to rewrite URL with page http://welcome.com/about.php into something like this URL http://welcome.com/about/ 是否有可能将带有页面http://welcome.com/about.php URL重写为类似该URL的http://welcome.com/about/

But already have some rewrite rules : 但是已经有了一些重写规则:

Options +Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^view/([0-9]+)/([0-9]+)/([A-Za-z0-9-]+)\.html/?$   data_view.php?id=$1&cat=$2 [NC,L]

RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^data/include/(.+)?  Admin/$1


ErrorDocument 400 /page-not-found
ErrorDocument 401 /page-not-found
ErrorDocument 403 /page-not-found
ErrorDocument 404 /page-not-found
ErrorDocument 500 /page-not-found

UPDATE 更新

I am looking http://welcome.com/about.php?id=12&cat=13 into http://welcome.com/about/12/13 我正在将http://welcome.com/about.php?id=12&cat=13 放到 http://welcome.com/about/12/13

Have it like this: 像这样:

ErrorDocument 400 /page-not-found
ErrorDocument 401 /page-not-found
ErrorDocument 403 /page-not-found
ErrorDocument 404 /page-not-found
ErrorDocument 500 /page-not-found

Options +Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^view/(\d+)/(\d+)/([A-Za-z\d-]+)\.html/?$ data_view.php?id=$1&cat=$2 [NC,L,QSA]

RewriteRule ^data/include/(.*)$ Admin/$1 [L,NC]

# rewrite /about/ or /about to /about.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM