我有这样的网址 http://www.shreyinnovations.com/edudemo/app-detail/?app-detail=A-Level%20Revision 我需要像下面这样替换 http://www.shreyinnovations.com/edudemo/ app/A-Level%20Revision
我将 .htaccess 文件更改为如下所示
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /edudemo/
RewriteRule ^app/([0-9]+)$ app-detail?app-detail=$1 [QSA]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /edudemo/index.php [L]
</IfModule>
# END WordPress
我还使用 wordpress 功能来更改 appche 规则以像这样重写地址
add_action( 'init', 'app_detail_rewrite_rules' );
add_action( 'generate_rewrite_rules', 'app_detail_rewrite_rules' );
function app_detail_rewrite_rules(){
add_rewrite_rule('^app/([0-9]+)','app-detail?app-detail=$matches[1]','top');
}
但我仍然无法获得我想要的网址。如果有人对此有解决方案,请告诉我。
提前致谢。