在每个html或php url上显示index.php,而不更改url
在每个html或php url上显示index.php,而不更改url 例如,用户键入anything everything.html(.php)将显示index.php而不更改url 条件-主机上不存在的任何东西everything.html(.php) 像404重定向一样,在不更改url的情况下使用apache重写(如果您使用apache并有权访问服务器)。在每个html或php url上显示index.php,而不更改url,php,.htaccess,url,redirect,Php,.htaccess,Url,Redirect,在每个html或php url上显示index.php,而不更改url 例如,用户键入anything everything.html(.php)将显示index.php而不更改url 条件-主机上不存在的任何东西everything.html(.php) 像404重定向一样,在不更改url的情况下使用apache重写(如果您使用apache并有权访问服务器)。 来自的配方应该可以。欢迎使用SO。如果您在Apache Web服务器上运行您的网站,则可以使用来实现这一点。下面是一个.htacces
来自的配方应该可以。欢迎使用SO。如果您在Apache Web服务器上运行您的网站,则可以使用来实现这一点。下面是一个
.htaccess
文件的示例,您必须将其放置在网站的根目录中
# switch on mod_rewrite
RewriteEngine On
# redirect all non-www request to www
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# rewrite all physical files and folders
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
# add all exceptions that should not be redirected
RewriteCond %{REQUEST_URI} "/layout/" [OR]
RewriteCond %{REQUEST_URI} "/javascript/" [OR]
RewriteCond %{REQUEST_URI} "/content"
# and finally pass everything to the index.php as a parameter
RewriteRule .* - [L]
RewriteRule (.*) index.php?value=$1 [QSA]
这将执行以下操作:
- 如果用户请求,他将被禁止
- 请求domain.com/hello/world.html将在index.php文件中以一个现有的
结束,该文件保存$\u GET['value']
,然后可以进一步处理hello/world.html
/hello
将被重定向到hello.PHP
?用于echo urlof currunt PageRequire的PHP文件对于allpagesex来说需要不同的echo。这是php