.htaccess - Use RegEx to redirect using data from files -


recently, restructured large site of 1 of our customers. caused news-articels on site on different place. problem google cache still showing them on old location, leading lot of 404 not founds ( 1400 news entries ).

normally, redirect using simple regex fine, not path news did change, parameters. example:

old url:

http://www.customers-url.com/old/path/to/the/news/details/?tx_ttnews%5btt_news%5d=67&chash=a782f3027c4d00face6df122a76c38ed 

how new url should like:

http://www.customers-url.com/new/path/to/news/?tx_news_pi1%5bnews%5d=65 

as can see, parameter d did change 67 65 , part of url before ? did change. also, tx_ttnews has changed tx_news , tt_news changed news , &chash part did fall away completely.

i have changed ids in csv in following format:

old_id, new_id 1,2 2,3 ...etc... 

same goes the changed url part before ?. since im not expert in using regex question is:

can done inside .htaccess using regex ( not sure if can use file input)? how complicated that? , how such regular expression like?

rather trying use .htaccess, easier manage , easier code if make new page responds on old url (/old/path/to/the/news/details), make page build new url , return 301 browser new url.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -