我正在使用 mod-rewrite 来制作真正的网址
www.example.com/public/questions.php?question_id= <int>
去
www.example.com/questions/ <int>
那么怎么可能禁止以前的地址用作 REQUEST_URI 并只允许它们通过我的新缩短的 url?
如果我提出一个规则
RewriteRule ^public public/page404_ready.php
这也使我当前更改的所有网址都没用。
(如果我确实完成了这一切,我是否必须将页面中所有我自己的(AJAX)链接更改为新的 URL?)
这是我现在的文件
RewriteRule ^questions/topics/(.+)/?$ public/questions.php?topics=$1 [NC,L]
RewriteRule ^questions/ask/?$ public/ask_question.php [NC,L]
RewriteRule ^questions/edit/([0-9]+)/?$ public/edit_question.php?question_id=$1 [NC,L]
RewriteRule ^questions/posts/edit/([0-9]+)/?$ public/edit_post.php?post_id=$1 [NC,L]
RewriteRule ^users/edit/([0-9]+)/?$ public/edit_profile.php?user_id=$1 [NC,L]
RewriteRule ^(admin)/?$ public/$1/index.php [NC,L]
RewriteRule ^(admin)/(\w+)/?$ public/$1/$2.php [NC,L]
RewriteRule ^(admin)/(\w+)/(\d+)/?$ public/$1/$2.php?topic_id=$3 [NC,L]
RewriteRule ^([\w\-]+)/?$ public/$1.php [NC,L]
#RewriteRule ^public public/page404_ready.php [L]