我已经在drupal 8视图块中成功实现了分页。 现在它为我生成以下URL:
http://tommiecrawford.local/node?page=1
但我不想要这个。
我想为我的分页链接提供以下网址。
http://tommiecrawford.local/blog/page/1
http://tommiecrawford.local/blog/page/2
http://tommiecrawford.local/blog/page/3
等。
我已经尝试过使用htaccess,但它没有使用以下配置:
RewriteCond %{THE_REQUEST} page=$
RewriteRule . http://tommiecrawford.local/blog/page/$1 [R=301,L]
是否有模块或修复程序?
感谢。
答案 0 :(得分:1)
您可以使用:
RewriteEngine on
# external redirect from actual URL to pretty one
RewriteCond %{THE_REQUEST} \s/+node\?page=([^\s&]+) [NC]
RewriteRule ^ /blog/page/%1? [R=302,L,NE]
# internal forward from pretty URL to actual one
RewriteRule ^blog/page/(.+?)/?$ /node?page=$1 [L,QSA,NC]