Php 将地址保留在url.htaccess中
我的网站上有一个目录:Php 将地址保留在url.htaccess中,php,regex,apache,.htaccess,mod-rewrite,Php,Regex,Apache,.htaccess,Mod Rewrite,我的网站上有一个目录: /new/ 我想访问它并重定向到index.php,它位于下面的一个级别,但不想更改地址url,例如: accessing: www.site.com/new/ check out www.site.com /index.php and the url remains www.site.com/new/ 在htaccess中,无法执行以下操作: <IfModule mod_rewrite.c> RewriteEngine On Rewri
/new/
我想访问它并重定向到index.php,它位于下面的一个级别,但不想更改地址url,例如:
accessing: www.site.com/new/
check out www.site.com /index.php
and the url remains www.site.com/new/
在htaccess中,无法执行以下操作:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^novo/*$ /index.php [NC,L]
</IfModule>
重新启动发动机
重写规则^novo/*$/index.php[NC,L]
他怎么办?创建一个包含以下内容的文件
/new/.htaccess
:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /index.php [L]
你没有在/new目录下放置index.php文件有什么原因吗?但我想保留/new/并让他转到index.php,它可以访问,但不保留/new/o/new只是一个重定向,但我想将其保留在URL中。你真的相信
不会加载类型的注释会对你的事业有所帮助吗。如果您提供足够的信息,比如没有加载的CSS URL是什么,那么它将真正帮助您。尝试在css、js、图像文件中使用绝对路径,而不是相对路径。这意味着您必须确保这些文件的路径以http://
或斜杠/
开头。