简体   繁体   English

htaccess RewriteRule抛出404

[英]htaccess RewriteRule throwing 404

I am trying to get a wordpress site to Rewrite to a NetSuite page, keeping the Wordpress URL but taking the user to the NetSuite page. 我试图获得一个Wordpress网站以重写到NetSuite页面,保留Wordpress URL,但将用户带到NetSuite页面。

For examle User types in http://sighfye.com/my/111/2222 and they go to 例如,在http://sighfye.com/my/111/2222中输入用户名,然后转到

https://forms.na2.netsuite.com/app/site/hosting/scriptlet.nl?script=XXX&deploy=X&compid=XXXXXXX&h=XXXXXXXXXXXXXXX&id=1116&ref=2222 https://forms.na2.netsuite.com/app/site/hosting/scriptlet.nl?script=XXX&deploy=X&compid=XXXXXXX&h=XXXXXXXXXXXXXXX&id=1116&ref=2222

In there url they will still see http://sighfye.com/my/111/2222 在该网址中,他们仍然会看到http://sighfye.com/my/111/2222

And the parameters 111 and 2222 are fed into the netsuite url. 并将参数111和2222输入到网络套件url中。

This is my htaccess file 这是我的htaccess文件

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(\w+)/(\w+)/?(\w+)?/?$ 
"https://forms.na2.netsuite.com/app/site/hosting/scriptlet.nl?script=XXX&deploy=X&compid=XXXXXXX&h=XXXXXXXXXXXXXXX&id=$1&ref=$2&api=$3" [P]
</IfModule>
# END WordPress

Whenever I test this and go to http://sighfye.com/my/111/2222 I get a 404 error. 每当我对此进行测试并转到http://sighfye.com/my/111/2222时 ,都会收到404错误。

Note: These give urls are for example only and this the real urls. 注意:这些给出的URL仅作为示例,这是真实的URL。

What am I missing? 我想念什么?

Try this code, 试试这段代码,

 <IfModule mod_rewrite.c> RewriteEngine On RewriteRule http://sighfye.com/my/111/2222 https://forms.na2.netsuite.com/app/site/hosting/scriptlet.nl?script=XXX&deploy=X&compid=XXXXXXX&h=XXXXXXXXXXXXXXX&id=1116&ref=2222 [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d </IfModule> 

Thanks! 谢谢!

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

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