我的.htaccess重写规则有问题(我是新手,所以这很容易)
我有一个网址是:
http://www.example.com/film-al-cinema/?titolo=Ghost+in+the+Shell&id=315837
Run Code Online (Sandbox Code Playgroud)
所以我在第一个变量中有电影的标题,titolo=""在第二个变量中有电影的ID id=""。
我希望网址看起来像
http://www.example.com/film-al-cinema/Ghost+in+the+Shell/315837
Run Code Online (Sandbox Code Playgroud)
我试图用以下方式更改htaccess文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^film-al-cinema/(.*)/([0-9]+)$ film-al-cinema/?titolo=$1&id=$2 [R]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
但这会将我重定向到404页面
编辑
我正在使用Wordpress,所以/film-al-cinema/是Wordpress页面
编辑2
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^film-al-cinema/([^/]+)/(\d+)/?$ /index.php?page_id=21016&titolo=$1&id=$2 [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Run Code Online (Sandbox Code Playgroud)