<a href="central-cliente">Click here to go to the client center</a>
<a href="clientarea.php">Click here to go to the client center</a>
我希望客户端看到友好的网址,即使他点击了不友好的网址(.php,.html等)
Options +FollowSymlinks
RewriteEngine On
Options -MultiViews
RewriteBase /painel/
RewriteRule ^central-cliente$ ./clientarea.php [L,NC]
RewriteRule ^registro$ ./register.php [L,NC]
RewriteRule ^entrar$ ./clientarea.php [L,NC]
RewriteRule ^sair$ ./logout.php [L,NC]
RewriteRule ^whois-dominio$ ./domainchecker.php [L,NC]
RewriteRule ^pagina-inicial$ ./index.php [L,NC]
RewriteRule ^sua-conta$ ./clientarea.php [L,NC]
RewriteRule ^base-conhecimento$ ./knowledgebase.php [L,NC]
RewriteRule ^tickets-suporte$ ./submitticket.php [L,NC]
RewriteRule ^status-servidor$ ./serverstatus.php [L,NC]
RewriteRule ^recuperar-senha$ ./pwreset.php [L,NC]
RewriteRule ^status-servidor$ ./serverstatus.php [L,NC]
RewriteRule ^tickets-suporte-geral$ ./submitticket.php?step=2&deptid=1 [L,NC]
RewriteRule ^central-cliente$ ./clientportal.php [L,NC]
RewriteRule ^meus-dados$ ./clientarea.php?action=details [L,NC]
RewriteRule ^meus-servicos$ ./clientarea.php?action=products [L,NC]
RewriteRule ^meus-dominios$ ./clientarea.php?action=domains [L,NC]
RewriteRule ^meus-orcamentos$ ./clientarea.php?action=quotes [L,NC]
RewriteRule ^minhas-faturas$ ./clientarea.php?action=invoices [L,NC]
RewriteRule ^meus-tickets$ ./supporttickets.php [L,NC]
RewriteRule ^afiliados$ ./affiliates.php [L,NC]
RewriteRule ^meus-emails$ ./clientarea.php?action=emails [L,NC]
RewriteRule ^sair$ ./logout.php [L,NC]
RewriteRule ^enviar-ticket$ ./submitticket.php?step=2&deptid=1 [L,NC]
RewriteRule ^download$ ./downloads.php [L,NC]
RewriteRule ^carrinho$ ./cart.php [L,NC]
RewriteRule ^extras$ ./cart.php?gid=addons [L,NC]
RewriteRule ^renovar-dominio$ ./cart.php?gid=renewals [L,NC]
RewriteRule ^registrar-dominio$ ./cart.php?a=add&domain=register [L,NC]
RewriteRule ^pagamentos-multiplos$ ./clientarea.php?action=masspay&all=true [L,NC]
RewriteRule ^adicionar-credito$ ./clientarea.php?action=addfunds [L,NC]
RewriteRule ^cartao-credito$ ./clientarea.php?action=creditcard [L,NC]
RewriteRule ^base-de-conhecimento$ ./knowledgebase.php [L,NC]
RewriteRule ^downloads$ ./downloads.php [L,NC]
RewriteRule ^status-da-rede$ ./serverstatus.php [L,NC]
RewriteRule ^sub-contas$ ./clientarea.php?action=contacts [L,NC]
RewriteRule ^emails-enviados$ ./clientarea.php?action=emails [L,NC]
RewriteRule ^mudar-senha$ ./clientarea.php?action=changepw [L,NC]
RewriteRule ^afiliados$ ./affiliates.php [L,NC]
RewriteRule ^suporte$ ./submitticket.php?step=2&deptid=1 [L,NC]
RewriteRule ^transferencia-dominio$ ./cart.php?a=add&domain=transfer [L,NC]
答案 0 :(得分:1)
不幸的是,您的映射没有统一的模式。您必须首先有一个规则高于所有其他规则以防止无限重定向循环
# prevent endless loop
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]
然后逐个添加反向映射以获取简单的URL
RewriteRule ^clientarea.php$ central-cliente [R,L]
或有条件,如果您有查询字符串
RewriteRule ^clientarea.php?action=details$ meus-dados [R,L]
将不工作,因为?action=details
不是网址路径的一部分。您必须拥有RewriteCond
%{QUERY_STRING}
RewriteCond %{QUERY_STRING} action=details
RewriteRule ^clientarea.php$ meus-dados? [R,L]
最后的问号?
会抑制替换网址中的查询字符串。
也许,你可以使用RewriteMap
和txt
至少对于简单的一对一重定向和维护简单文本文件中的映射列表。但这与你的.htaccess中有一长串RewriteRule
s没什么不同。