hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Urgent help needed.
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

Urgent help needed.

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 10-24-2010, 05:17 PM
Bontheone Bontheone is offline
Newbie
 
Join Date: Apr 2009
Posts: 24

Urgent help needed.


Righto going to throw this out here hopefully someone can help.

I have a large set of old files I need to re-upload for tomrow.

The problem being that due to how they were given to me, whilst internet explorer parses the pages correctly, any other browser does not and just shows the source rather than rendering it.

Each page is a static page, there is no dynamic linking or such.

They are saved in the format, generic.php@page=1 generic.php@page=2 generic.php@page=3 ect. Each page has a link to another generic page, this goes upto 63,000 files.

If I go and add .html onto the file name, so generic.php@page=1.html the other browsers will render the page. However by adding the .html it breaks the links the other pages show.



So, my options.



a) I need a way to mass rename all files to add .html onto the end, then mass edit all the files internally to link to the new .html page

I have a biterscript I used to edit some other stuff, however I have some problems making this work with wildcards.



b) a way to force the .html extention onto the page once it is requested. I tried through htaccess, however again I had problems. I could get it to rewrite it down to generic.html, but it would need to rewrite it to generic.php@page=1.html



The bitterscript is here.

Any suggestions?



var str list ; lf -n "*.php" "F:\Project_Files\test" > $list

while ( $list <> "")
do

var str file ; lex "1" $list > $file

var str content ; cat $file > $content

while ( { sen -c "^generic.php@page=*^" $content } > 0 )
sal "^generic.php@page=*^" "generic.php@page=*.html" $content > null

echo $content > { echo $file }
done





Cheers

Reply With Quote


Sponsored Links
  #2  
Old 10-24-2010, 06:59 PM
GGWH-James GGWH-James is offline
--. --. .-- ....
 
Join Date: Oct 2010
Location: ON, Canada
Posts: 960
You could use something like Notepad++ to do a find/replace in all files using regex. As for the file renaming, what OS are the files to be hosted on? You could write a simple script (i.e. bash, PHP, etc.) to rename the files by appending ".html" to the filename.

__________________
GG Web Hosting
Backup, Digital (SSL) Certificates, Domains, Hosting, Privacy Policy, Software
S/W: Peel Ads, Softaculous, WHMCS Addons (Abuse Mon., Affiliate Peel Ads, Client Stat., Ord. Prevention, Ord. Stat., Softaculous NOC, Sys. Cleanup)
Authorized Reseller Program


Reply With Quote
  #3  
Old 10-24-2010, 08:33 PM
GGWH-James GGWH-James is offline
--. --. .-- ....
 
Join Date: Oct 2010
Location: ON, Canada
Posts: 960
I probably should have mentioned, if using the Notepad++ method of find/replace, the following should append ".html" to all instances within the file(s):
Find what:
(generic\.php@page=[0-9]*)
Replace with:
\1.html
Test it out with a single file using the Replace tab though, prior to using it to replace in all files using the Find in Files tab. Also, be sure that "Regular expression" is selected as the Search Mode.

The other method you could use to do it all at once, is to write a script that will read the contents of each file, append ".html" to all instances, write the contents back with the changes, rename the file, and repeat with the next.

__________________
GG Web Hosting
Backup, Digital (SSL) Certificates, Domains, Hosting, Privacy Policy, Software
S/W: Peel Ads, Softaculous, WHMCS Addons (Abuse Mon., Affiliate Peel Ads, Client Stat., Ord. Prevention, Ord. Stat., Softaculous NOC, Sys. Cleanup)
Authorized Reseller Program



Last edited by GGWH-James; 10-24-2010 at 08:41 PM.
Reply With Quote
Sponsored Links
  #4  
Old 10-25-2010, 04:31 AM
fabin fabin is offline
Web Hosting Evangelist
 
Join Date: Mar 2009
Location: Gods Own Country
Posts: 530
You said you have 63000 files. Thats a large amount of files to work manually. May be, you are using windows. If it was in linux, you can use bash and sed to replace it in one go

Code:
for i in `seq 1 63000`; do for j in `seq 1 63000`; do sed s/href=\"generic.php\@page=$j\"/href=\"generic.php\@page=$j.html\"/g generic.php\@page=$i; done; done
Some thing like above will do the trick.

__________________
Fabin M @ Xieles Support
High Quality Server Management | support @ xieles.com
http://xieles.com

Reply With Quote
  #5  
Old 10-25-2010, 05:12 AM
GGWH-James GGWH-James is offline
--. --. .-- ....
 
Join Date: Oct 2010
Location: ON, Canada
Posts: 960
Quote:
Originally Posted by fabin View Post
May be, you are using windows. If it was in linux, you can use bash and sed to replace it in one go
Ya, I'd asked what OS was being used but no reply though. I assumed Windows from seeing "F:\Project_Files\test" in the post though.

__________________
GG Web Hosting
Backup, Digital (SSL) Certificates, Domains, Hosting, Privacy Policy, Software
S/W: Peel Ads, Softaculous, WHMCS Addons (Abuse Mon., Affiliate Peel Ads, Client Stat., Ord. Prevention, Ord. Stat., Softaculous NOC, Sys. Cleanup)
Authorized Reseller Program


Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT - Help needed - URGENT jcast2 Systems Management Requests 5 04-07-2008 10:39 AM
Urgent Help Needed... $$$ HelloLily Employment / Job Offers 1 11-13-2004 05:50 AM
Urgent Help needed! SSla - KoRRupt Programming Discussion 3 10-19-2004 12:36 AM
****! Urgent urgent help needed! tgzo Web Hosting 32 07-27-2004 02:35 PM

Related posts from TheWhir.com
Title Type Date Posted
Software AG Acquires Cloud PaaS Vendor LongJump Web Hosting News 2013-04-26 12:05:25
Web Host GeekStorage Opens New Office in Oklahoma, Names Account Manager Web Hosting News 2012-07-31 14:04:33
Web Host 405 Networks Acquires Huevia Web Hosting Web Hosting News 2012-07-30 16:16:02
Web Host VISI Provides Hosting Services to Minnesota Public Radio Web Hosting News 2011-12-30 15:45:36
Cirrus Tech Updates its VPS Hosting Offering Web Hosting News 2011-12-20 22:30:00


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?