php - Error when converting a web.config to .htaccess in rewrite

194

I'm migrating a server, it was all php but it was on a windows server (don't know why, but it is what it is :P)

  <rule name="category2" stopProcessing="true">
     <match url="^categoryi/([0-9]+)/([0-9]+)/([a-zA-Z0-9_ -]+)" ignoreCase="false" />      
     <action type="Rewrite" url="listbycategory.php?id={R:1}&amp;pagenumber={R:2}" />" />
  </rule>

I tried with:

Options Indexes FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^categoryi/([0-9]+)/([0-9]+)/([a-zA-Z0-9_ -]+)/?$ listbycategory.php?id=$1&amp;nroPagina=$2

But the world explodes, any clues on what i'm making a mess?

541

Answer

Solution:

You should escape the space in your rewrite rule, so change your rewrite rule line into:

RewriteRule ^categoryi/([0-9]+)/([0-9]+)/([a-zA-Z0-9_\ -]+)/?$ listbycategory.php?id=$1&amp;nroPagina=$2

Note the \ before the space.

By the way, is it on purpose that you changed the pagenumber variable into nroPagina?

People are also looking for solutions to the problem: php - ZMQ PUSH/PULL model: Lost messages when a node PUSHes messages and exits

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.