Yii2 : Subdirectory in yii2 not working - yii2

I created a sub folder in yii2 installed project and I want to work this sub folder as a normal html website but its redirecting to yii2 login page. How to make it work as a normal html website?

You can add it inside the yii2app/frontend/web/ folder. Because this folder is public.
Rewrite the url if you want. For example:
RewriteRule ^desiredurl/$ frontend/web/subfolder/filename [NC,L]

In my eyes, you can think of your sub folder as a module in yii2, which can be accessed as a single section with a route like this:
[your root directory]/[your module name]/[your controller under the module]/[your action]

Check the Yii2 routing as well, make sure the application is allowing access to the html directory. Ideally you would put you HTML in the 'view' directory as per MVC/Yii2 design principles.

For example you add normal_html folder in yii2 directory. You should edit web server's configuration (if it's nginx change root else if apache change DocumentRoot) folder.

No need to create folder in web folder . You can just achieve this by creating a folder in your yii2 root directory but keep remember below things :
1. Keep index.html/index.php in your sub folder.
2. Do not use subfolders in your subfolder.
3. Your subfolder files should not in format of yii2 url format.

Create your subfolder with your HTML page within your /web folder. When your Yii2 Website is reachable via http://localhost/ you're now able to call your HTML Website via http://localhost/your-subfolder/your-html-file.html.

Related

HUGO + GitHub Pages: How to set up subdomain

I have a github repository that I want to add my hugo site to. From the docs folder in my repository I can run github pages.
Therefore, I have changed my publishDir parameter in the hugo config to docs.
publishDir = "docs"
Now when I build hugo it ouputs everything in the docs folder which is great, the issue is running a subdomain from there.
How do I get a subdomain on hugo that is generated into my docs folder that acts like a subdomain on github pages?
I know I would need to use a CNAME and then tell it to say /docs/subdomain is actually subdomain.site.com
but I am not sure how to set that up in HUGO. and where do I put the subdomain folder? in the static folder so it would be theme_name/static/subdomain which would ouput into the docs like docs/subdomain?
If this is the way, can I use all the parameters and shortcodes in my static folder?
Also, if I need to create 2 hugo installations, one for the main site and one for the subdomain site, is their a way to share site params, configs, static files and layout files etc… ?
You have to create a custom script to create two different builds and then
Add a CNAME file to your project's repository. The content of this file must be a single line specifying the bare subdomain for your project's custom subdomain (e.g. pjname.mydomain.com).
In your DNS provider's settings, create a new CNAME record that points project name to either the root (usually denoted by #), if you have previously set up an apex domain, or to myusername.github.io if you've set up a custom subdomain. It should look something like this:
If you have two sites that you want to serve separately under two domains/subdomains (or even subpath), it's better that you create two different repositories for that.
In your username.github.io repository, you are using the "docs" folder to serve your site. However, this procedure will not work for other repositories. To serve from other repositories, name the repo whatever you like and create a "gh-pages" branch on it. The branch root must contain the entire site. You can access this site using username.github.io/your-repo-name/.
In this new repo you can add a CNAME. Hope this works. I did almost the same thing, except that I used subpaths instead of subdomains. Here's my main profile rafed.github.io and my blog rafed.github.io/devra/

How can i hide my files and folders as they can be seen as "Index of /test/admin" on my server

click here to see problem snapshot
this is the thing i want to hide from public, i tried everything on my server, my friend suggested me to use HotLink protection and it says it prevents other websites from directly linking to files (as specified below) on your website. Other sites will still be able to link to any file type that you don't specify below (ie. html files). i tried that but still it does not works.
i think i have to create .htacess file but i am not sure what should i type in that file so that my all website links are protected
You can also hide your files and folders from directory listing using directoryindex directive,
DirectoryIndex /file.html
/file.html is the file you want to show instead of the directory listing.
You're right you need to create a .htaccess file and copy the below code in it.
Options -Indexes
Hope this helps!

Web site title showing index of

Google search jobbulls website title showing index/
I have uploaded all of my files for my website. When I type in my domain name, I see a page titled "Index of /" that lists each of the files used to create my website. Can anyone tell me how to fix this?
Your first page should be called index.html
In fact, it can be called a lot of names, this is the priority that will decide the one to display: (higher first)
index.html
index.shtml
index.php
index.htm
default.html
Default.htm
default.html
Default.html
default.shtml
Default.shtml
page1.html
index.pl
index.cgi
index.php3
index.phtml
home.htm
home.html
home.shtml
index.wml
based on the DirectoryIndex by Apache.
Now as a second answer, if you uploaded the files and these contain a file listed above and it still doesn't work, then make sure you uploaded the files in the correct directory. Sometimes ftp brings you one level higher than what is called the 'webroot' check to see if there is no 'public_html' or 'www' or 'html_docs'.
In that case, make sure your files are uploaded in this folders.
It maybe the uploading folder problem.
First of all you can try these 3 methods,
Option 1 – Upload Your Website via xxxx's File Manager
Option 2 – Uploading Your Website via FTP such as FileZilla
Option 3 – Uploading Your Website via cPanel’s File Manager
Select the option and start to upload.
Open the server folder and you may can see some folders like .htaccess, public_html.. Please open the folder public_html and upload into it.
If you still see the problem, reupload the files again.
Thank you.
You need an index or a page for the web server to serve up as the page for the site.
To get started you could upload an "index.html" page and most web servers will serve this as their first page by default.
Upload this line to your .htaccess file and see what happens
DirectoryIndex index.html index.php
If that doesn't work, can you post the contents of your .htaccess file?
This should work for a site coded with php.
Best solution for this you have to set Options -Indexes in .htacess file.
I had the same problem. This was because I used an capital 'I' as first i of index.html. This did not work because 'Index.html' was not in my directory listings. The standard solution for this would be changing Index.html to index.html. (note the capital 'I' and the lowwer case 'i')
ok first of you have to upload zip file while so It will not give to error while uploading.
put your folder in public_html section extract it.
main page of your file which have to call by default by entering your site name
is index.html don't give name Index.html system has access for index.html

Drupal: The easiest way to create HTML page without usage of drupal

How can I make Drupal "print" the .html file which is stored inside Drupal directory (e.g. in drupal root directory, or in sites/all/files/)?
I want to get that .html file by simple path like http://www.mydomain.com/thatfile.html, without theming, etc.
P.S. to explain the motivation: I want users to be able to print the location map from the site (pressing "Print map" link). I could do it not redirecting the user to new tab (I want them to be redirected to new tab :)). But what if user will accidentally press "Cancel"? (User can become confused)
Thanks in advance.
If Drupal is hosted on http://example.com/, and there is a file named results.html, visiting http://example.com/results.html you will get the content of that HTML file.
One of the rewrite rules included in the .htaccess file Drupal comes with says to the web server to serve a file that exists.

You don't have permission to access /betaSite/ on this server

I'm having a big problem. I just revamped this apt. companies website and created the new website in a folder contained in the current website. I just finished and have put all of the old site files into and oldSite folder and brought all the new files out of the betaSite folder and into the public folder. I've tried changing the file persmissions but idk if they are sticking. Please help! I really have no clue how to fix this. Thanks!
asirentals.com
asirentals.com/index.shtml
From here: http://www.thesitewizard.com/apache/install-apache-2-windows.shtml
If you want "index.shtml" to be your default start page for your directories, ie, if you want Apache to load "index.shtml" when you type "localhost" or "localhost/directory/", you will need to search for a line in your "httpd.conf" that begins with "DirectoryIndex" and add index.shtml to the list of files there. For example, modify it as follows:
DirectoryIndex index.shtml index.html