Can the sitemap files be in a folder if the sitemapindex is in the root path? - sitemap

I want to have a sitemap structure where the sitempasindex file is located in the root path (example.com/sitemaps.xml) and it references several sitemap[n].xml files located in a folder (example.com/static/sitemap1.xml). Those sitemap[n].xml files link to webpages that are in the rooth path (like example.com/helloworld.html).
Is that posible? I'm asking because I know that if the sitemap.xml file is placed within a folder, it can only contain webpages that are under that folder.
Thanks!

I believe you easily have
example.com/sitemap-index.xml
point to e.g.
example.com/sub1/sitemap.xml
and
example.com/sub2/sitemap.xml
however each sitemap.xml should only contains URLs within each their subfolder. (From your question, it seems you have those sitemap.xml files link to paths in root. I doubt that works, but you could try run a small test and submit to Google. If no errors then...)

The location of a Sitemap file determines the set of URLs that can be included in that Sitemap. A Sitemap file located at http://example.com/catalog/sitemap.xml can include any URLs starting with http://example.com/catalog/ but can not include URLs starting with http://example.com/images/.
From google perspective, they should be available on main root of the website. http://example.com/sitemap.xml, When you submit it through the subdir in webmaster tool "http://example.com/catalog/sitemap.xml" google won't crawl it and always showing us pending index status.

Related

Is there some assistance with AJAX and PHP?

I am trying to use AJAX to return high-level calculation results. However, it appears as though the PHP file that I am pointing the AJAX call to is in the '/' root directory. Here is a snapshot of how my structure is: c:\webserver\test\webroot (this is the root directory), and then c:\webserver\test\code is where the HTML and PHP files are stored - looking to use an AJAX call to point to a PHP file in the non-root folder (which is one folder up, then one folder down). I tried a few different things, such as '../code' to move up and then over, but that doesn't work. Any suggestions?
Referencing a file location via relative paths should work - you'll just need to be sure that you are navigating FROM the correct folder TO the correct folder.
This can be a bit tricky if your javascript file is located in another folder - if memory serves you must navigate from the folder containing the javascript file, not from the folder containing the index file.
Alternately, you can use FQDM http://example.com/folder/folder/file.php to reference the file. Note that if you are on localhost, you can use a hosts file to fake-out the webserver.

CodeIgniter: How to load css file that is WITHIN application folder

It appears that this question is asked often and answered the same way: store the css files outside of the application directory and then use base_url() . "path/to/file".
However, I want to keep my css files and js files inside my application/views/ directory, because the views directory is effectively the html space, and css and js belong to that space (in my opinion).
Below is the structure that I wish for:
root
- application
-- views
--- assets
---- css
---- js
- system
When I attempt to load css files from within this directory structure, I get a NetworkError: 403 Forbidden, which makes sense because of CI's framework protocol.
But I am guessing that there is a way.
Publicly reachable files like CSSes images and JS files need to be in public directory next to index.php file. So hierarchy would be:
root
- application
- system
- assets
-- css
-- js
You can aproach to those files with hard coded
Link
or using (loaded) url helper with it's function base_url() or site_url(). Don't forget to fill correct URL into application config file.
Link
Docs.
Hey i'm going to politely push back on this idea :-)
Your application and system folders should be ABOVE the root, so they are not publicly accessible. (Unless this is a really simple application and you are not doing any database interaction, etc). They should not be considered part of the HTML or public space because you do not want the public accessing them. Set the path for them once in the main index.php file and its done.
Also i suggest renaming your system and application folders, like "system302". Over the long term it makes versioning and upgrading (and reverting if needed) much easier.

Joomla index.html file

Why is there an index.html file in almost every folder in Joomla? What folders do not contain an index.html file and why?
The blank index.html file in each folder is to prevent directory browsing via web address.
On a poorly configured web server someone could see all the files contained in a folder by simply browsing to the path, such as www.yoursite.com/images/, this could be a potential security problem on servers without directory browsing (indexing) turned off.
Having the blank index.html file returns a blank white screen to the browser rather than displaying the contents of the folder.
The index.html file isn't necessary, it's in the folders as a layer of security. It is there to keep prying eyes from being able to see a directory structure, if there was no index.html file and someone randomly went to http://yoursite.com/scripts/js/ (for example), they could potentially see a listing of all files in that directory. Instead, with the index.html file in place they see a blank landing page:
<html><body bgcolor=" #FFFFFF" ></body></html>
Another approach (for apache servers) is to add this line to the .htaccess file placed at the root directorty of the website:
Options -Indexes
It prevents directory browsing for the whole website.

Is there a way to detect sitemap, if it is not in robots.txt?

I'm working for a simple bot for a project, and I noticed, that a lot of sites do not have sitemaps in their robot.txt files. There is of course an option to simply index the sites in question and crawl all possible pages, but that often takes much more time than simply downloading sitemap.
What is the best way to detect sitemap if it is not mentioned in robots.txt?
Normally it should be placed in the root directory of a domain like xydomain.xyz/sitemap.xml .
I would only add the site map into the robots file, if it is placed elsewhere. If a site uses more than one site map located on another place, it should be noted in an index map.
You can use this online tool to scan your site and create a bespoke sitemap.xlm file for your site.
To help your sitemap to be discovered through the robot.txt add the URL of your sitemap at the very top of your robot.txt file, (see below example).
So, the robots.txt file looks like this:
Sitemap: http://www.example.com/sitemap.xml
User-agent:*
Disallow:

Web pages - tree hierarchy

How can I see all files and subdirectiories at http://www.anywebpage.com/directory. When I visit some page like http://www.anywebpage.com/directory, it shows me only index.html but I would like to see tree hierarchy - files and subdirectories. Is it possible?
If you mean:
Can I request a directory listing from arbitrary third party web servers?
Then the answer is a resounding no
If you mean:
Can I configure my web-server to serve up a directory listing but also have a default index page that is not that listing?
Then it is possible, but I'm not aware of any web server that has such a feature built in, so you will need to write a (or find a third party) script that will give you those listings when you hit a different URL (that you choose).
When you enter a directory, you go to the index file automatically.
If there is no index file, You will most likely see all the files in the directory.

Resources