Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Site works in Windows but not Linux

Status
Not open for further replies.

justride

Programmer
Jan 9, 2004
251
US
Hi all,

We have an existing windows folder that is web based. All html that has links to various html files, PDF files, you name it. It’s really big. This Folder which we run on a Windows Server, works great for all our Windows users... However we would like to migrate it over to an existing Linux server as reference.

The problem is, when the entire html was designed, the Word Docs were designed, the Excel Docs were designed etc. They used spaces in the file names. Now I know this can result in a Linux problem but I'm not sure if that’s the exact problem.

When we attempt to load these pages on the Linux server we get page cannot be found errors left and right. For example:

Code:
In Windows the HTML file will look like:
<a href="a%20folder\another%20folder\index.htm">The Index</a>
When the link is highlighted in a web browser, the path that appears is:
"c:/a folder/another folder/index.htm" and works

In Linux the HTML file will look like:
<a href="a%20folder\another%20folder\index.htm">The Index</a>
when the link is highlighted in a web browser, the path that appears is:
"/usr/chris/a folder/another folder\index.htm"
For some reason, in Linux the last slash always gets reversed from the other, causing our paths to be invalid.

Now I could go change the HTML etc... I could go rename all the doc files. I could rename everything, all the excel links etc. But very time consuming.

Does anyone know if there is anything I could do? Why this is happening? A batch rename for the whole site? Something quicker? A work around?

Thanks so much!
Chris
 
I believe that all the slashes need to be forward on a linux system.

If you use a multiple-text-file editor you could perhaps open all your HTML files and do a search and replace - all \ replaces with /

I'm on a windows PC using a program called NoteTab. This allows you to search and replace in multiple files. Here's a link to NoteTab (comes in a fully functional freeware version - NoteTab Light) :
Do yourself a favour - make a backup before you try it!!

Regards


Jakob
 
Thanks for the tip. I just need it to work in both environments without changing for both. I guess they make updates weekly on the Microsoft Platform, so if we could get them on one format that works for both platforms, then that would be good.

Chris
 
Chris,

It looks like your not running it on a web server. If you setup a webserver, then forward slash will apply -no matter what OS.

On WinXP and Win2k server I use a server-package (Apache, MySQL, PHP, CGI, Perl etc) called FoxServ:


It works just fine! And it's sooo easy to setup too.

If you migrate to a real webserver you will get many additional benefits like server side scripts, password protection and many many more.... consider it!

Regards


Jakob
 
I know it's going to take some time, but I would seriously recommend you update both sites with a new naming convention so that you don't have spaces, use _ or - instead.
Also be aware that linix is case sensitive, so make all your filenames lowercase, and your images the same, so that if you ever do put in backend scripting, auto generation of files will be simple and images will be found.

the time spent cleaning up the site (hey you may wish to do a re-design at the same time- use server side includes for your headers and footers or something) will be well worth it for the future. Using spaces in file naming makes the pages very hard to find when typing the url in the window.

----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
Thanks guys, its really appreciated.

Do any of you know if theres a script or a way for me to rename 2500 files/folders to substitute spaces for underscores?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top