0

Following is my configuration:

<rule>
    <from>^/xf/(.*)$</from>
    <to>/xfDetail?id=$1</to>
</rule>

The url I visited is http://mydomain/xf/63e2d96047754072a340610. But it says that the page cannot be found.

Do I configure it incorrectly?

This is my working one:

<rule>
    <from>/jr</from>
    <to>/jr/index</to>
</rule>

By the way, are there any ways debugging this?

Thank you!

Sky
  • 7,343
  • 8
  • 31
  • 42

2 Answers2

1

Your rewrite rule will not match with any URL because it requires '/' right after previous domain.

So, the rule should be:

^xf/(.*)$

And, Here is explaination

Explain

If you're using Apache and mod_rewrite, you can have a look at this question: How to debug Apache mod_rewrite

Community
  • 1
  • 1
The Anh Nguyen
  • 748
  • 2
  • 11
  • 27
  • 1
    Thank you. But seems it's not working for my case ToT – Sky Dec 14 '16 at 09:51
  • I've found the root cause as shown in my answer. The `^/xf/(.*)$` is from the manual, it's my first time using this, not sure if there's any difference comparing to the older version. Thank for your help anyway. – Sky Dec 19 '16 at 02:11
0

It turns out to be that I had another rule which handles the request like this:

<rule>
    <from>/xf</from>
    <to>/xf/index</to>
</rule>

The default matching type for URLRewrite is regex, so my request url matches /xf, then the actual url is /newHouse/index/xxxxx. Obviously there's no this page existed.

So, in order to get it working, I have to change it to this:

<rule>
    <from>/xf$</from>
    <to>/xf/index</to>
</rule>

The $ is needed at the end of the from.

Sky
  • 7,343
  • 8
  • 31
  • 42