php - 301 redirect code to new folder structure URLs -


i use redirect on old site:

rewritecond %{http_host} ^(www\.)?oldsite\.com$ [nc,or] rewritecond %{http_host} ^www\. [nc] rewriterule ^oldfolder(/.*)?$ http://newsite.com/newfolder$1    [l,r=301,nc,ne]  rewritecond %{http_host} ^(www\.)?oldsite\.com$ [nc,or] rewritecond %{http_host} ^www\. [nc] rewriterule ^(.*)$ http://newsite.com/$1 [l,r=301,ne] 

this redirect code me:

  • first,to redirect www non www on new site
  • second,to redirect oldsite urls oldfolder newsite urls newfolder

the problem old urls have index.php on structure , redirection wrong. example:

oldsite.com/index.php/oldfolder/....

redirect to

newsite.com/index.php/oldfolder/....

but right redirection should to

newsite.com/index.php/newfolder/.... or newsite.com/newfolder/....

how can change redirect code make right redirections newfolder structure urls?

you can use following rule redirect oldsite/ newsite :

rewritecond %{http_host} ^(www\.)?oldsite\.com$ [nc] rewriterule ^oldfolder/(.*)$ http://newsite.com/newfolder/$1    [l,r=301,nc,ne] 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -