.htaccess - multiple parameters friendly URL rewriteRule -


I need help on rewriteRule for several parameters:

  sitename.com/ Project .php? To become T = value1 and a = value2   

  sitename.com/project/value2/value1   

But in any case I was unable to solve the problem and 500 internal server error

The page shown to my HTAC file:

  DirectoryIndex index .php option -index & lt; Files * htaccess & gt; From all & lt; / Files & gt; & Lt; Files page & gt; Forteotype application / X-HPD-PHP & lt; / Files & gt; & Lt; IfModule mod_rewrite.c & gt; Option + SymLinksIfOwnerMatch RewriteEngine% {REQUEST_FILENAME} on rewriting! -d Rewrite Convert% {REQUEST_FILENAME}! -f #resolve .php Extension Extension Rewrite for php URL% {REQUEST_FILENAME}. Php -f rewrite rule ^ (. *) $ $ 1.php [L] RRRRRRRR ^ CP / edit-agent /([^/\.]+)/?$ cp / edit-agent.php? Name = $ 1 [L] Rev. Raul ^ ([^ /.] +) /? $ Agent.php? Name = $ 1 [L] Example # / 123 / sys RewriteRule Project / ([0- 9] +) / ([^ / \. +] /? #Crew to handle $ Project.php? A = $ 1 & amp; T = $ 2 [L, QSA] & lt; / IfModule & gt;   

Please help.

You see the rule is right for the most part, but you have 2 problems first and The most obvious problem is that you have 2 conditions which are only applied to the first rule:

  rewrite angle% {REQUEST_FILENAME}! -d RecoveryCand% {REQUEST_FILENAME}! -f   

Applies only to this rule:

  Extend the .pp file for extension # php urls% {REQUEST_FILENAME}. Php -f rewrite rule ^ (. *) $ $ 1.php [L]   

Whenever this rule needs to be applied:

  RewriteRule ^ ([^ /.] +) /? $ Agent.php? Name = $ 1 [L]   

Conditions apply only to the following rules immediately, so you have to duplicate them.

The other problem is not so obvious, but it may be due to a 500 error, the condition is:

  rewrite% {REQUEST_FILENAME}. Php -f   

The problem is that you have such requests: / project / 123 / abcd and you have the file /project.php < / Code>. The path information is also considered in the % {REQUEST_FILENAME} variable, so if you stick to .php at the end, then it actually checks: Check the code> /project.php/123/ABCD and -f check. Use yourself in the rule, you are adding it to the end, as follows: project / 123 / abcd.php . Then around the next time, the same situation passes again, then .php is added to the end: project / 123 / abcd.php.php , this Like the infinite loop

So you need to change to change your rules:

  directory index index.php option -index -mood view & lt; Files * htaccess & gt; From all & lt; / Files & gt; & Lt; Files page & gt; Forteotype application / X-HPD-PHP & lt; / Files & gt; & Lt; IfModule mod_rewrite.c & gt; Option + SymLinksIfOwnerMatch RewriteEngine rewrite code% {REQUEST_FILENAME}! -d Rewrite% {REQUEST_FILENAME}! -f #resolve .php Extension Extension Rewrite for php URL% {DOCUMENT_ROOT} / $ 1 \ .php -f Rewrite Rule ^ (. *) $ $ 1 .php [L] RewriteRule ^ cp / edit-agent / ([ ^ / \.] +) /? $ Cp / edit-agent.php? Name = $ 1 [L] Revcoted% {REQUEST_FILENAME}! -d RecoveryCand% {REQUEST_FILENAME}! -f revised rule ^ ([^ / \.] +) /? $ Agent.php? Name = $ 1 [L] Example # 003 / sys # Project to handle RewriteRule / ([0- 9] +) / ([^ /.] +) /? $ Project.php? A = $ 1 & amp; T = $ 2 [L, QSA] & lt; / IfModule & gt;    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -