简体   繁体   English

.htaccess重定向+重写问题

[英].htaccess redirect + rewrite problems

I'm trying to redirect http://www.example.com/ to http://www.example.com/public/plebs/ using the htaccess file. 我正在尝试使用htaccess文件将http://www.example.com/重定向到http://www.example.com/public/plebs/

But my problem is that I don't want the url's to look like this: http://www.example.com/public/plebs/.example.php but like this: http://www.example.com/example.php 但是我的问题是我不希望该网址看起来像这样: http://www.example.com/public/plebs/.example.php : http://www.example.com/public/plebs/.example.php但是像这样: http://www.example.com/example.php : http://www.example.com/example.php

Let me now if you could help me, thanks. 如果您能帮助我,请让我现在,谢谢。

Try something like: 尝试类似:

RewriteCond %{REQUEST_URI} !^/public/plebs
RewriteRule ^(.*)$ /public/plebs/$1 [L]

or 要么

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/public/plebs/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/public/plebs/$1 -d
RewriteRule ^(.*)$ /public/plebs/$1 [L]

depending on how you've got your server setup. 取决于您如何设置服务器。

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

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