A website about mobile phone, with WordPress base board.
The original htacess is placed in the main directory/var/www/html
Rewriteengine onrewritebase/rewriterule ^items/products/(\d+)/(. *)? $ items/products.php?number=$1&name=$2 [QSA , L]rewritecond%{request_filename}!-frewritecond%{request_filename}!-drewriterule. /index.php [L]
Create a new. Htacess in sub-directory '/var/www/html/2014
Rewriteengine onrewritebase/2014/rewriterule ^phone/products/(\d+)/(. *)? $ phone/products.php?number=$1&name=$ 2 [Qsa,l]rewritecond%{request_filename}!-drewritecond%{request_filename}!-frewriterule (. *) $1.php [L]
Now you want to permanently redirect the old URL address to the new URL.
www.example.com/items/products/1234/iphone-5c
=
www.example.com/2014/phone/products/1234/iphone-5c
I'm trying to fix the source code in items/products.php.
Unexpectedly error Request exceeded the limit of internal redirects due to probable configuration error. Use ' limitinternalrecursion ' to increase the limit if necessary. Use the ' LogLevel debug ' to get a backtrace.
Change the source code back to the original, add echo ' http://www.example.com/2014/phone/products/'. $_get[' number '. ' /'. $_get[' name '];
Page normal display http://www.example.com/2014/phone/products/1234/iphone-5c, the mouse right-click to open the URL in a new window, you can normally jump, but why the Apache return error?
And then try to modify
And then the htacess in the main directory.
Rewriterule ^item/products/(\d+)/(. *)? $ items/products.php?number=$1&name=$2 [qsa,l]
Become
Rewriterule ^2014/phone/products/(\d+)/(. *)? $ items/products.php?number=$1&name=$2 [QSA,L,R=301]
This time unexpectedly jump to wordpress 404 page.
Depressed, in the end how to do, to normal jump?
Reply to discussion (solution)
1) Header jump error, the wrong wording. Header ("Location: $url");
In addition the inside of the $_get these few if not exist, and did not set the error level, then still easy to error
2) rewrite the file. htaccess do not need to be placed in the/2014/directory, directly in the original/rewrite can
#by default7#zbphp.com
rewriteengine onrewritecond%{request_filename}!-drewritecond%{REQUEST_ FILENAME}!-frewriterule ^items/products/(\d+)/(. +)? $ 2014/phone/products/$1/$2/ [l,r=301]rewriterule ^ 2014/phone/products/(\d+)/(. +)? $ phone/products.php?number=$1&name=$2 [Pt,qsa,l]rewriterule (. *) $1.php [L]