将多个URL加载为一页


Load Multiple Urls as One Page

不能100%确定如何操作,但我知道它很简单。htaccess,但我不知道该怎么做。

基本上,我希望它加载一个index.php文件,无论它们在包含index.php的文件夹中指向哪个url,例如:http://website.com/folder/thisisntafile.php将在名为folder的文件夹中加载:index.php。无论加载了/folder/file.php,都会发生这种情况。

谢谢!

试试这个:

RewriteEngine on
#Rewrite "folder/file"
#don't rewrite "folder/index.php"
Rewritecond %{REQUEST_URI} !/index.php$
 RewriteCond %{REQUEST_URI} ^/([^/]+)/[^.]+('.php|html)?$
RewriteRule ^ /%1/index.php [NC,L]

这将重写

 http://example.com/foo/bar.php

 http://example.com/foo/index.php