Apache htaccess setting default index.html or <folder name>.html - apache

We have an automated legacy system that provides zip files with html content (including images and other files). The system will either provide a folder with an index file or a file with the name as the folder.
For example say the file being sent in was User Supplies.zip
We would either see a folder structure like this
User Supplies/index.html
or like this
User Supplies/User Supplies.html
Currently we examine the contents for the zip file and rename anything that matches the folder name back to index.html. Since there could be other html files in there it has become a bit of spaghetti code to get it to work.
We could get rid of all this code if we can include something to the equivalent of "Use index.html or [folder name].html as the default file"

Related

Can't upload theme to Prestashop

So I purchased a prestashop theme from TemplateMonster and the zip file is 324MB and when I try to upload the file in admin, I get an error that the file is too large. I know I can change php settings and maybe get it to work, but I figured I would just ftp it to my server, but filezilla drops the connection when I try to upload it. First, before I change php settings, will it work with such a large file? Also, when I look inside the zip file, I see a .sql file, a psd.zip, readme_en.zip, and 2 other zip files. Do all these files need to be uploaded? Just asking because I'm not sure why the PSD.zip file would need to be included.
413 Request Entity Too Large
Probably the main theme package contains additional assets, but in order to have your theme installed in Prestashop you just need the "main" ZIP theme
(the one that once unzipped contain folders like /assets /templates /modules etc.)
Then you can choose to upload it from your backoffice (you need to set the PHP max_upload_filesize accordingly) or copy the zip directly in your /themes directory and choose the "Import with FTP" option for the "Themes & Logo > Theme > Add new theme" backoffice page.
If you're having trouble with that method too, you can use the "Import from the web"
method by uploading your ZIP in a reachable public URL

How to create new folders on my domain name

As you can tell from the title, I don't know what words that I should use to describe what I want to do.
I just want to be able to change my website's files from:
www.example.com/bark.php
and www.example.com/leaves.php
to
www.example.com/tree/bark.php
www.example.com/tree/leaves.php
While having a www.example/tree.php page as well.
So, I'm working with PHP and am building this with Sublime text editor. Is this an .htaccess job?
Thanks in advance :)
You don't need .htaccess or any programming language.
Simply create the folder, put your files in it, and upload them back to the server. You'll also want to delete the old files on the server as well.
Alternatively, you can rename the files on the server itself. You can either right-click on the target file, and click 'Move'.
You can also drag the files directly by clicking-and-dragging:
The file www.example.com/tree.php is just another file, stored in the ROOT folder. You are allowed to have a folder and a file with the same name.
www.example.com/tree will point to the tree folder, and attempt to access the index at www.example.com/tree/index.html or www.example.com/tree/index.php.
The file www.example.com/tree.php will not be loaded when viewing www.example.com/tree without .htaccess configuration.
Hope this helps! :)

Determining whether a file is linked to a project or not

I'm writing a project documenter and I write out the full file path of each compiled file. This is for the VB.NET language so .proj files are written in xml.
Any file that is linked to the project exists on the same drive so at least one of the directory levels are the same for all files. I currently have it set up to put the project directory path on files which exist inside the project since it only shows the name of the file and the residing directory it lives in if its in a directory inside the project. For files outside (linked in) to the project I initially saw their files paths were "..\..\..\dir\filename". So I set it up to take off all the "..\" and put the necessary directories in front of it and all that worked fine. Now for this one .proj file some of the linked in files have their full file path with no "..\".
How can I properly distinguish these three possible inputs?
System.IO.Path.IsRooted will tell you whether a path is rooted, i.e. is a full path, or not. If the path is not rooted it is a relative path. You can use Path.Combine to resolve the full path from a relative path.

replacing content from cache to document directory?

In my Document folder i am having a folder named folder1 in that folder i am having css,js,main.html etc.. i am opening the main.html in webview....If any updates are done in server i am downloading folder2 and unzipping it in cache directory For example: i am having css,js ,main.html in folder1 in document directory and a new update is done in server and i am downloading folder2 and unzipping in cache directory in folder2 i am having css only now i want to compare these folder1 and folder2 content if equal means in this example css is present in both the folders i want to delete css in document directory folder1 and i want to replace the css which is in folder2 to folder1...this is the process next time if any update is done then i may download js not css at that time i want to replace only js.can any one help how to check the content and replace ... please help me its imp to me
As per my understanding, you are using Documents directory to store the CSS and HTML to be loaded inside UIWebView and Caches directory to unzip and store latest CSS and HTML files from the server. After unzipping, you want to compare the contents of CSS and JS files in Caches folder with the contents of CSS and JS files in Documents folder and replace if they have changed.
There are 2 steps in this:
Standardizing files names across both folders so that you know which file from Caches directory should be compared with which file from Documents directory. Give the same names to files that are to be compared.
On fetching the file from server and unzipping in Caches folder, you can get use NSFileManager class to access the same file (names are same as mentioned in point 1) in your Documents directory and then read it in an NSString and then compare that with another NSString that contains your Caches folder content. If the comparison returns equal you can skip. Else, you can use
NSFileManager *manager = [NSFileManager defaultManager];
[manager copyItemAtPath:sourcePath(CachesDir) toPath:destinationPath(DocumentsDir) error:&error]
This will copy your latest unzipped item from CacheDirectory to Documents Directory.
However, you may want to double check saving content in Documents Directory as it is backed-up on iCloud account to which the device is mapped. Please read about this further.

Trying to create .htaccess file using ftp doesn't work

I want to create a .htaccess file in a specific directory. I'm using Notepad++ and their plug-in for FTP (NppFTP). I'm able to create any other files and see them in the folder but when I try to create a .htaccess I don't see that file in the directory. I get no errors, it is like nothing happened.
I tried to create this file using an FTP program and it showed the file and right away it disappeared. My guess it is because this is a special file used by the system and prefixed by a (.)
What is a way to edit that file?
This is probably because your ".htaccess" file is a hidden file and your system is set up to no display hidden files.
Have a look in your Notepad++ settings if there's an option to make hidden files visible/unhide.
In addition to that check the windows folder options for that option!
switch on showing hidden files in your ftp client