开发者

how can i redirect via htaccess

开发者 https://www.devze.com 2023-01-13 22:36 出处:网络
i want to redirect http://abc.com/a to /mypage.php?par1=a and http:/开发者_开发百科/abc.com/a/b to /mypage.php?par1=a&par2=b

i want to redirect

http://abc.com/a to /mypage.php?par1=a and 
http:/开发者_开发百科/abc.com/a/b to /mypage.php?par1=a&par2=b

how can it be done?


The following should be enough:

<IfModule mod_rewrite.c>
  RewriteBase /

  #so i doesn't match a real file/folder
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

  RewriteRule ^(\w+)$ mypage.php?par1=$1
  RewriteRule ^(\w+)/(\w+)$ mypage.php?par1=$1&par2=$2
</IfModule>
0

精彩评论

暂无评论...
验证码 换一张
取 消