I am in the process of rebuilding a site in WordPress that was built 20+ years ago on an .asp framework. Forgive me if this is OT. I was hoping someone in WSE that has had to do a site move like this may have a solution.
I have tried the following Regex but does not seem to work:
Source URL: /(.*).aspx
Regular expression: checked ☑ OR Select "REGEX" after Source URL
Target URL: /$1/
For the pdf's - Here is an overview. Original folder structure for .asp site:
https://aspsite.example/parent_folder/somedocument1.pdf
https://aspsite.example/another_folder/somedocument2.pdf
https://aspsite.example/parent_folder/sub_folder/somedocument3.pdf
The WordPress upload folder structure would be something like this:
https://example.com/wp-content/uploads/2022/06/somedocument1.pdf
https://example.com/wp-content/uploads/2022/09/somedocument2.pdf
The problem: Many of the pdfs from the old site have links within them that link to other pdfs stored on the server. It is not feasible to go into all the pdfs and change the links to the new folder structure in WordPress. Ideally if a link in a PDF is
https://aspsite.example/parent_folder/somedocument1.pdf
It will redirect to
https://example.com/wp-content/uploads/2022/06/somedocument1.pdf
All PDF docs carry the idential file name in WordPress. The problem area is everything between the .com and the file name :/
I ran across this expression in SO:
Source URL: ^\/([^\s\/]+\.pdf) Target URL: example.com/wp-content/uploads/2021/01/$1
...but this will only redirect to one folder which does not work since I currently have 5 media folders in Year/Month format.