简体   繁体   中英

Load Multiple Urls as One Page

Not 100% sure how but I know its simple .htaccess but I have no idea what to do.

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. This will happen for whatever /folder/file.php is loaded.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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