.htaccess 重定向原始url以重写url(htaccess)
如何重定向原始url以重写url 原始: domain/index.php?p=50 重写: 域名/邮政/50/ 我试着在这里更好地解释 如果 请求:domain/index.php?p=50 重定向到:域/post/50/ 重写为:domain/index.php?p=50 感谢您使用此代码:.htaccess 重定向原始url以重写url(htaccess),.htaccess,mod-rewrite,.htaccess,Mod Rewrite,如何重定向原始url以重写url 原始: domain/index.php?p=50 重写: 域名/邮政/50/ 我试着在这里更好地解释 如果 请求:domain/index.php?p=50 重定向到:域/post/50/ 重写为:domain/index.php?p=50 感谢您使用此代码: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^post/([0-9]+)$ index.php?p=$1 [L]
你必须以另一种方式思考:
- 用户将使用domain/post/50
- 我将把这个url重写为domain/index.php?p=50