Htaccess多个重定向一个页面


Htaccess multiple redirect for one page

我有一个问题:我为我未来的网站做了一个空白页,我有一个问题。

有一个页面是由这些url (account.php)提供的:

http://site。domain/en/account/——可以访问,但如果没有/,我无法访问它
http://site.domain/en/account/create/-可以访问,但我有同样的问题http://site.domain/en/account/create/verify/——无法访问当前的http

我的htaccess是这样的:

RewriteEngine On
AddDefaultCharset UTF-8
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{HTTP:Accept-Language} ^([a-z]{2})- [NC]
## Rewrite Rules
RewriteRule ^account/?$ /%1/%{REQUEST_URI} [L,NC,R]
RewriteRule ^([a-z]{2})/(account)/([^/]+)/([^/]+)?$ /$2.php?language=$1&type=$3 [L,NC,QSA]

所以我想做的是,让所有的重定向都可以通过htaccess访问。

例如,上面提到的htaccess中的数据,我可以访问帐户页面和创建页面,但不能验证页面。如果改成:

RewriteRule ^([a-z]{2})/(account)/([^/]+)/([^/]+)/([^/]+)?$ /$2.php?language=$1&type=$3&subtype=$4 

我可以访问创建和验证页面,但不能访问帐户页面本身。

所以我想要实现的是,能够访问所有这3个页面用一个htaccess规则,所以基本上只是重定向用户用htaccess没有php的帮助,即使帐户。php确定哪个请求发出并为请求提供正确的页面

有没有关于htaccess和相关问题的好书,因为我不知道它是什么,也不知道如何使用它

这样做:

AddDefaultCharset UTF-8
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{HTTP:Accept-Language} ^([a-z]{2})- [NC]
## Rewrite Rules
RewriteRule ^account/?$ /%1%{REQUEST_URI} [L,NC,R]
RewriteRule ^([a-z]{2})/(account)(?:/([^/]+)(?:/([^/]+))?)?/?$ /$2.php?language=$1&type=$3 [L,NC,QSA]