简体   繁体   English

.htaccess,mod-rewrite和Wordpress

[英].htaccess, mod-rewrite and Wordpress

I have inherited a wordpress project and am having some problems with rewriterules in the .htaccess file. 我继承了一个wordpress项目,并且.htaccess文件中的重写器出现了一些问题。 I am trying to set it up such that this url: 我正在尝试将其设置为以下网址:

site.com/meet-your-team/something/somethingelse site.com/meet-your-team/something/somethingelse

returns 退货

site.com/meet-your-team/index.php?page_id=30&param2=something&param3=somethingelse site.com/meet-your-team/index.php?page_id=30&param2=something&param3=somethingelse

This worked without any problems when it was hosted on a windows box, unfortunately it is bombing on the linux server we currently have it on. 当它托管在Windows盒上时,它可以正常工作,但是不幸的是,它在我们目前使用的Linux服务器上轰炸。

When troubleshooting the problem, I found out that all three parameters are making it to the index.php page and wordpress is using the page id to generate the page I need. 在对问题进行故障排除时,我发现所有三个参数都使其进入了index.php页面,而wordpress使用页面ID来生成我需要的页面。 However it seems to lose the other two parameters when the page is displayed. 但是,显示页面时似乎丢失了其他两个参数。 Does anyone have any ideas how I can keep parameters 2 and 3? 有谁知道如何保留参数2和3?

This is the line of code I am using. 这是我正在使用的代码行。 I am new to htaccess and rewrites so forgive me if all I am missing is a single character. 我是htaccess的新手,如果我只想念一个字符,请重写一下。

RewriteRule meet\-your\-team/([^/]+)/([^/]+)/? index.php?page_id=30&category_slug=$1&profile_slug=$2 [L]

Thanks in advance for anyone willing to point me in the right direction. 预先感谢任何愿意为我指出正确方向的人。

我认为您需要添加一条规则,该规则要替换三件事,如果我没有记错的话,则需要以插入符号开始第一个字符串,并以美元符号结束,因此:

RewriteRule ^meet\-your\-team/([^/]+)/([^/]+)/([^/]+)/?$ index.php?page_id=30&category_slug=$1&profile_slug=$2&third_slug=$3 [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM