简体   繁体   English

将多个页面加载为一页

[英]Load Multiple Urls as One Page

Not 100% sure how but I know its simple .htaccess but I have no idea what to do. 不是100%知道如何操作,但是我知道它简单的.htaccess,但是我不知道该怎么办。

Basically I want it to load a index.php file no matter what url they go to in the folder containing the index.php for example: http://website.com/folder/thisisntafile.php will load: index.php in the folder named folder. 基本上,无论它们在包含index.php的文件夹中进入哪个url,我都希望它加载index.php文件:例如: http ://website.com/folder/thisisntafile.php将加载:名为文件夹的文件夹。 This will happen for whatever /folder/file.php is loaded. 无论加载/folder/file.php都会发生这种情况。

Thanks! 谢谢!

Try this : 尝试这个 :

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]

This rewrites 这改写

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

to

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

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

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