Hello i have static html site in the root folder ex: www.example.com . and WordPress site in sub-folder ex: www.example.com/blog so where to put htaccess file in root or subfolder. and how to configure single htaccess file to work for both site.
It depends on what you have in this htaccess file. If it's the Wordpress file, put it in the subfolder.
Anyway, you can have an htaccess file in both directory, the one in the subfolder will ovveride any file in parents directories.
Related
I have been given a folder in a subdomain to host my files.
https://sub.domain.com/folder
However the HTML files were all written referencing to root path (i.e. href="/css/style.css", etc.) which breaks everything.
Is there a way to htaccess and rewrite engine so that the codes will work with the root path set as /folder/ as root instead of /?
I want to allow directory listing in all sub folders inside folder root, but the root folder should not be able to be directory listed. but i wish to do this with just 1 htaccess file in the root folder, not having to place a Options +Indexes htaccess file in each sub folder.. is this possible?
The best solution for this is to create an index file in the root folder. If you do not have an index file, you can use mod-rewrite, the following rule in your htaccess to deny directory listing for the root.
RewriteEngine on
RewriteRule ^$ - [R=403,L]
I want visitors on www.domain.com to be served with a pdf file on www.domain.com/file.pdf automatically.
The file shoudl be shown in the browser. Not downloaded. Is this possible to do with .htaccess rules?
My webhoster runs apache.
Put this code in root directory .Htaccess :
DirectoryIndex file.pdf
I have a "site" setup to allow myself some "public" downloads.
So in the root folder of the site I have an htaccess file containing
Options +Indexes
IndexOptions +FancyIndexing
Inside the site I have a couple folders with files for downloading, etc...
How can I disable the ability to get into the parent folder once inside one of these folders?
For instance...
http://o7thwd.com/dl/Mine
I'd like to prevent the Parent Directory from showing and being able to do anything...
Remove the .htaccess file from the site's root folder.
Put the following (same as in your question) in .htaccess file in every sub-folder that needs to be public:
Options +Indexes
IndexOptions +FancyIndexing
I have three subfolders /software1/, /software2/ and /software3/ for three different applications in the main root directory for domain.com. The .htaccess rules for these subfolders are interfering with the .htaccess file in the main directory. So, I wonder if there is a rule to add into the .htaccess file in the main directory to ignore the rest of the file and directly jump into the /software1/, /software2/ and /software3/ subfolders (i.e. their .htaccess files) if URI is http://domain.com/software1/..., http://domain.com/software2/... and http://domain.com/software3/...?
It would have been nice to see your current .htaccess rules so we can see what it's doing or not doing. But if you just want to not do anything for the 3 directories, you can try this in the main .htaccess and just have it not do anything if it is one of those 3 directories.
RewriteEngine On
RewriteRule ^(software1|software2|software3)$ - [L,NC]