如何重定向 URL

How to redirect URLs

/index.php?Bank=abhyudaya-cooperative-bank 必须重写并重定向到

/abhyudaya-cooperative-bank.html 和

同样

http://example.com/index.php?Bank=abhyudaya-cooperative-bank&State=gujarat 必须重写并重定向到 http://example.com/abhyudaya-cooperative-bank/gujarat.html

我知道可以通过 .htacces 文件完成。我不知道该怎么做。 请帮我。谢谢。

您可以将代码添加到您的 .htaccess 文件中。可能有用。

RewriteEngine on
RewriteRule ^([0-9a-zA-Z-_]+).html$  index.php?Bank= [L,QSA]
RewriteRule ^([0-9a-zA-Z-_]+)/([0-9a-zA-Z-_]+).html$  index.php?Bank=&State= [L,QSA]

祝你好运。

在您的 .htacess 文件中尝试以下代码

选项 +FollowSymlinks

重写引擎开启

rewritecond %{http_host} ^http://example.com/[nc]

重写规则 ^(.*)$ http://example.com//$1 [r=301,nc]

RewriteRule ^([0-9A-Za-z'/+_.&;-]+).html$ index.php?Bank=$1

RewriteRule ^([0-9A-Za-z'/+.&;-]+)/([0-9A-Za-z'/+。 &;-]+).html$ index.php?Bank=$1&State=$2

在您的 .htaccess 中尝试以下操作

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9-]+)\.html$  index.php?Bank= [L,NC]
RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9]+)\.html$ index.php?Bank=&State= [L,NC]