开发者

.htaccess ModRewrite question

开发者 https://www.devze.com 2022-12-19 03:01 出处:网络
trying to do rewrite rulefor this: http://website.com/checkreg/34324234<--- Old URL Location to this:

trying to do rewrite rule for this:

http://website.com/checkreg/34324234 <--- Old URL Location

to this: http://website.com/chkreg.php?checkreg=34324234 <--- New URL Address

I've tried the following, but it causes an error 500 message, I don't know enough about ModRewrite to figure out the issue.


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngi开发者_Go百科ne On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^checkreg/([^/]*)$ /chkreg.php?checkreg=$1 [L] 
RewriteRule . /index.php [L]

</IfModule>

# END WordPress


You said you want to rewrite from http://website.com/chkreg.php?checkreg=34324234 to http://website.com/checkreg/34324234, but your rewrite rule is doing the opposite.

Use this:

RewriteRule ^chkreg.php?checkreg=(.*) /checkreg/$1 [L] 

Edit: If you need further debugging information from mod_rewrite then add the following:

RewriteLog /your/path/rewrite.log
RewriteLogLevel 3
0

精彩评论

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