[英]rewrite wordpress url for specific page to remove trailing slash and add php extention
I want to remove trailing slash for a specific page in Wordpress and do some another changes.for example I have this page : http://www.domain.com/page/ I want to change the url to this : http://www.domain.com/page.php you know because I need send some get request and its so ugly with that trailing slash so any one can help?我想删除 Wordpress 中特定页面的尾部斜杠并做一些其他更改。例如我有这个页面: http : //www.domain.com/page/我想将 url 更改为: http:// www.domain.com/page.php你知道,因为我需要发送一些 get 请求,它的尾部斜杠太丑了,所以有人可以帮忙吗? thank you.
谢谢你。
You would then need to use a rule like the following in the .htaccess file in your www-root:然后,您需要在 www-root 的 .htaccess 文件中使用如下规则:
RewriteCond %{REQUEST_URI} !(page)/$
RewriteRule ^(page)$ http://example.com/page.php/ [L,R=301]
You can use the following Redirect您可以使用以下重定向
RedirectMatch ^/page/?$ /page.php
/? /? in the pattern above means the trailing slash is optional.
在上面的模式中意味着尾部斜杠是可选的。 This will redirect both /page or /page/ to /page.php
这会将/page或/page/重定向到/page.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.