Concrete 5 - Where to put .htcaccess - html

I have made my own theme in concrete 5 and produced a 600 page site, however im looking at speeding the site up according to Google Site Speed.
I did place the ..htcaccess file in the "themes" directory which contains my custom theme, however I think this was causing my site to have 500 internal server errors.
Where is the correct place of putting the .htcaccess file in the Concrete5 directory? Even better, does anyone have tips for what to include inside the .htcaccess. I have most of the content for it, but its mostly copied from gzip sites etc
Thanks in advance

It depends what you are doing in your .htaccess file and what the intention is. Usually though, you'll want to put it in your web root, i.e. place it at the same level as your main index file.

If you enable the "pretty url" feature of C5 via Dashboard > System & Settings > SEO & Statistics > Pretty URLs , it will generate an htaccess file for you at the proper place on your server (at the web root, as #danmullen mentions in his answer). Putting .htaccess in your theme directory will just not work, period.

Related

Why do people name their files index.html?

I have seen a lot of people been using that file name for their HTML files. I wonder why? I'm kind of new to HTML, I haven't learned much, but when I name my HTML files, I name them whatever I want. When I have been searching up examples of HTML, I have found they name it index.html. Why?
I have seen a lot of people been using that file name for their HTML files
You would typically use that name for one of your page, and it would usually be the home page.
When you arrive a website, for example www.website.com, you're not pointing to a file (like you would be if you typed www.website.com/about.html), you're pointing to a directory listing of all the files.
The webserver will try to serve a file, typically called index.html or index.php by default, but it could be something different, and it's configurable by editing your webserver's config files.
If the server doesn't find any file to serve (because you didn't include an index.html file or because you renamed it without editing the server's config) you will see a listing of the files, which is rarely the desired behavior, especially at the root of a website.
Generally the contents of index.html will be returned when just the directory is requested.
e.g. http://example.com/index.html is returned for a request for http://example.com
This is merely convention and is usually configurable.
Here is my take: It was likely named 'index' in the original internet because it is the 'indexing page' that directs to the sub pages, and you would go back to the index page to go to another page. This was before images and search engines. Later it got more advanced with a menu on all pages. This is how I remember it, but it's a long time ago.
https://twitter.com/PresidentUSW1/status/1442236777293496325?s=20
The default landing page of many Web servers defaults to index.html or default.htm and either way it's simply a start page. It's not necessary at all.

Have Domain Open HTML File?

I am currently making a website, and have a folder containing CSS3 and HTML5 code in it. When I click on the index.html file, it opens up a local file and I can see my design and text in it. However, I am not sure how to have my website "point" to the index.html file, so it shows the content that is in the file. (I bought the domain with GoDaddy).
Thanks for the help!
Make Sure the directory does not have any other default files like default.php,default,html,etc and also there should be only one index file. if there is any index.php it will overtake index.html. Please make your question more clear and tell use which hosting are you using.....
Check documentation of the company that provides you hosting - the server has a list of files it looks for on disk in a given order. Only thing you need to do is to rename you file to match server's "lookup table".
Relevant part of configuration of the most popular web servers:
apache: https://httpd.apache.org/docs/current/mod/mod_dir.html
nginx: http://nginx.org/en/docs/http/ngx_http_index_module.html

How can I find my working directory?

You'll have to bear with my slightly on this, but please ask if I have left out any pertinent information. I have just taken over a project to create a dashboard for my team. This dashboard has been made using a niche third-party tool that nobody here will have used before. The third party tool auto-generates some code to display "markers" on a webpage. "Markers" being some proprietary code to query a database/apply custom styling etc.
I am trying to display a webpage within the page that has been generated, and I’d like to point this to a local webpage (ie on my C drive). If I pass it an absolute path, then this results in a warning in IE9 as I am mixing data sources - a https website pointing to a http web page. It will display after ignoring the warning, but my userbase is not comfortable enough with computers to ask them to do this.
I believe if I pass it a relative path then it should work, but I can’t find out what directory to base this path off and it doesn’t appear to be anywhere obvious. So, in my current page I have an image with the web address of : https://website:8443/websitereport/images/buttons/locked.gif. What I need to know is where the “websitereport/images” folder is stored so that I can put my webpage in there to give the webpage a relative path. The HTML for this image is :
<img id="dvp_locationbar_lock" class="dvp_imagebutton" style="" dvp_title="ui.tip.lock-page" dvp_image="locationBarPageUnlockedImage" src="/websitereport/images/buttons/unlocked.gif" title="Lock this page">
What are my options for discovering where this folder is stored locally? I am running Apache Tomcat 7.0. It is not displaying if I use the path based off
C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\work\Catalina\websitereport
of
\websitereport\page.html
And I cannot find it anywhere obvious in the Apache folder. I have tried :
Searching - no results.
Using PHP to print the current working directory - cannot find out
where to edit the webpage.
Looking at images/information on the existing webpage. They all point
to folders I cannot find.
Inspecting with firebug.
In short, you can't rely on the files being on disk at all - they might be just contained in a *.war file, containing the whole application. Or they might be generated on-the-fly, despite the name sounding like an actual file.
Also, you should not arbitrarily write within a directory even if you find it (my closest guess would be tomcat's webapps/websitereport/ directory if it exists) because nobody will know that something changed during the time since last deployment. So, on the next update of the application, you'll end up overwriting all of your changes again. You typically change the underlying application and redeploy.
You might also find a few references in tomcat's conf/localhost/ directory or even in conf/server.xml, but it all depends on how your server was administered

html directory listing formatting

So, I've been trying to get a web page to display links to videos (over a symbolic link) dynamically (i.e., without hardcoding an <a></a> tag for each one) I have, and I think I may have found a solution, albeit a hacky one:
Video
Ignoring that this is a horrible way to do this, does anyone know how to format the following?:
I'm guessing there is an apache config file somewhere, but it is extremely hard to search for it as I do not know what it is called when files are just listed in this manner.
i'm basically looking to resize the widths of columns, and maybe even do some pretty-fication.
this is all running on my web/file server and is being accessed form my local machine.
This is what you're looking for:
http://perishablepress.com/better-default-directory-views-with-htaccess/
This tutorial details how directory listing by Apache can be modified to suit your taste using HTAccess file.
Using Apache HeaderName and ReadmeName directives and the module "mod_autoindex.c" you can add custom markup to your directory listing pages.
For displaying links to A/V and other files, look at my website: https://wrcraig.com/ApacheDirectoryDescriptions.
It goes beyond the default directory description, providing a spreadsheet to assist in creating detailed descriptions and exporting them in FancyIndex/AddDescription format for inclusion in .htaccess.
It also provides a menu driven BASH scripted alternative, using the FancyIndex descriptive data above (automatically adding A/V durations) to recursively populate a custom index.html while retaining the security features of .htaccess.
The site has examples of the input spreadsheet and both the FancyIndex output and the optional BASH scripted output.

web-development: how do you usually handle the "under costruction" page"?

I was wondering what's the best way to switch a website to a temporary "under costruction" page and switch it back to the new version.
For example, in a website, my customer decided to switch from Joomla to Drupal and I had to create a subfolder for the new CMS, and then move all the content to the root folder.
1) Moving all the content back to the root folder always create some problems with file permissions, links, etc...
2) Creating a rewrite rule in .htaccess or forward with php is not a solution because another url is shown including the top folder.
3) Many host services do not allow to change the root directory, so this is not an option since I don't have access to apache config file.
Thanks
Update: I can maybe forward only the domain (i.e. www.example.com) and leave the ip on the root folder (i.e. 123.24.214.22), so the access is finally different for me and other people? Can I do this in .htaccess file ?
One thing to consider is you don't want search engines to cache your under construction page - and you also don't want them to drop your homepage from the search index either (Hence just adding a "noindex" meta tag isn't the perfect solution).
A good way to deal with this is do a 302 redirect (temporarily moved) from your homepage to your under construction page - that way the search engine does not cache your homepage as an under construction page, does not index your under construction page (assuming it has a NOINDEX meta tag), and does not drop your homepage from the search index either.
One way would be the use of an include on your template page.
When you want the construction page to show, you set a redirect in the include to take all traffic to the construction page.
When you are done your remove the redirect.
What about hijacking your index.php file?
Something simple, along the lines of
<?php
if (SITE_OFFLINE)
include 'under_construction.html';
else
//normal content of your index page
?>
where you would naturally define SITE_OFFLINE in an appropriate place for your needs.
What I did when I used PHP for websites was to configure Apache to direct all requests to a front controller. You then would have full access to all requests no matter where they are pointing to. Then in your front controller (PHP file, static html file, etc.), you would do whatever you need to do there.
I believe you need to configure pathinfo in Apache and some other settings, it has been about 3 years since I have used that approach. But, this approach is also good for developing your own CMS or application so that you have full control over security.
You have to do something similar to this:
http://www.phpwact.org/pattern/front_controller
I am looking for more details, I know my configuration had more to it than that.
This is part of what I'm looking for too:
http://httpd.apache.org/docs/2.0/mod/core.html
Enabling path_info passes path information to the script, so all requests now go through a single point of entry. Let me find my configuration, I know vaguely how this works, but I'm sure it looks like a lot of hand waving.
Also, keep in mind that because all requests are going through this single PHP file, you are responsible for serving images, JavaScript, CSS, etc. So, if a requests is coming in for /css/default.css, that will go through your php script (index.php, most likely), then you'll need to determine how to handle the request. Serving static files is trivial, but it is a little more work.
If you don't want to go that route, you could possibly do something with mod_rewrite so that it only looks for .html, .htm pages or however you have your site configured. For me, I don't do extensions, so that made my regex a little more difficult. I also wanted to secure access to all files. The path_info was the solution for me, but if you don't need that granularity, then writing a front controller might be a bit too much work.
Walter