I wish to write htaccess rules where I'm able to rewrite this

world wide web.example.com/Project_Title/1/23 project.html?n=$1&p=$2&i=$3​​​​​​​​​​​​​​

I've this already, the main problem is the fact that I've got a file in /projects/projects.xml which will get rewritten too after i refer to it as with Ajax.

RewriteRule ^([._-a-zA-Z0-9]*)/([-9]*)/([-9]*)(.?)$ /project.html?n=$1&p=$2&i=$3 [NC]

Suggested changes:

  • The [L] flag means: last rule. Any rules following this URL won't be parsed once the RegExp is matched up.

  • Added / at the start, to complement pathways in accordance with the document root.
  • Transformed * to +, since you most likely wish to match a minimum of one character, instead of accepting world wide web.example.com///
  • Changed (.?)$ by (.*)$: The very first option meant: "Match one or no figures in the finish". The proposal means: "Match any figures in the finish"
  • Removed A-Z from part one from the RegExp, since the NC flag causes the situation to become overlooked.


RewriteRule ^/projects/projects.xml - [L]

RewriteRule ^/([._-a-z0-9]+)/([-9]+)/([-9]*)(.*)$ /project.html?n=$1&p=$2&i=$3 [NC]

See also

Try adding RewriteCond % !-f over the RewriteRule. Presuming projects.xml is definitely an actual file, which should prevent spinning.