更新时间:2023-10-21 14:58:22
既然你似乎要与Apache的htaccess的做到这一点,你需要在的mod_rewrite
模块。在htaccess的,你会想是这样的:
RewriteEngine叙述上
重写规则^ main.php页=(+)及?ID =(+)/主/ $ 1 / $ 2 [NC]
这应该让你/主/页/ gettingpaidfortakingsurveys。这会不会连字符连接的词,我不能确定,你就可以做,没有什么过于复杂的。
I wanted to redirect this url from /main.php?page=pages&id=gettingpaidfortakingsurveys to /main/pages/getting-paid-for-taking-surveys.
Thanks!
[UDPATE]
i tested it on my existing cakephp .htaccess and it didn't work.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/main.php?page=(.+)&id=(.+) /main/$1/$2 [NC]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Since you appear to want to do this with Apache's .htaccess, you'll need the mod_rewrite
module. In the .htaccess, you'll want something like:
RewriteEngine on
RewriteRule ^main.php?page=(.+)&id=(.+) /main/$1/$2 [NC]
This should get you /main/pages/gettingpaidfortakingsurveys. This won't hyphenate the word and I'm unsure you'll be able to do that without something overly complex.