将所有页面重定向到SAME域上的单个页面

将所有页面重定向到SAME域上的单个页面

问题描述:

There are versions of this question already posted but i cannot get their suggestions to work.

Here is what i have already in my htaccess

Options +FollowSymLinks 
RewriteEngine on
RewriteRule ^([A-Za-z0-9]+)$ $1.php
RewriteRule ^home\.php$ index.php 
RewriteRule ^home$ index.php

and here is what i tried:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([A-Za-z0-9]+)$ $1.php
RewriteRule ^home\.php$ index.php 
RewriteRule ^home$ index.php
RewriteRule ^(.*)$ http://www.trainingthemlive.co.uk/maintenance.php [R=302,L]

No luck, just completely fails. I'd like www.trainingthemlive.co.uk to go to www.trainingthemlive.co.uk/maintenance

It's also worth noting that the maintenance.php page is in the root folder and def exists

此问题的版本已经发布但我无法得到他们的建议。 p> \ n

以下是我已经在我的htaccess p>

 选项+ FollowSymLinks 
RewriteEngine on 
RewriteRule ^([A-Za-z0-9] +)$ $ 1  .php 
RewriteRule ^ home \ .php $ index.php 
RewriteRule ^ home $ index.php 
  code>  pre> 
 
 

这是我试过的: p> \ n

 选项+ FollowSymLinks 
RewriteEngine on 
RewriteRule ^([A-Za-z0-9] +)$ $ 1.php 
RewriteRule ^ home \ .php $ index.php 
RewriteRule ^ home $  index.php 
RewriteRule ^(。*)$ http://www.trainingthemlive.co.uk/maintenance.php [R = 302,L] 
  code>  pre> 
 
 

没有运气,完全失败了。 我想www.trainingthemlive.co.uk去www.trainingthemlive.co.uk/maintenance

nn

还值得注意的是,maintenance.php页面位于根文件夹中, def存在 p> div>

You need to make sure not to redirect the maintenance page, and you probably want it before your other rules:

Options +FollowSymLinks
RewriteEngine on

RewriteRule !^/?(maintenance\.php|.*\.css|.*\.js)$ http://www.trainingthemlive.co.uk/maintenance.php [R=302,L]

RewriteRule ^([A-Za-z0-9]+)$ $1.php
RewriteRule ^home\.php$ index.php 
RewriteRule ^home$ index.php

You can use this single rule:

RewriteRule !^maintenance /maintenance [L,NC,R]

This will redirect all pages on your domain to /maintenance