Hide directory in source code - joomla

Actually my question is How is folder path hidden ? Firstly I am using Joomla.
I found a website 4 months ago, so i don't remember name of the website which is Joomla site. They hide their folder path.
Between to head> sth. head(tags). If you look at source code, you can see this part. And then this part include template name.
For example:
<link type="text/css" href="http://www.site.com/templates/template_name/css/style.css" rel="stylesheet"></link>
So we can learn to what the name of the template. But they hide this part. When i looked this part(http://www.site.com/templates/template_name/css), i can see only /style.css.
Do you have any idea?

You need two things to accomplish that.
A (system) plugin, that changes every template related URL to the 'official' format, eg.
$url = str_replace('/templates/template_name/css/', '/style/', $url;
An .htaccess redirect reverting the change.
RewriteRule ^style/(.*)$ templates/template_name/css/$1 [R=301,L]

If you want obscure template names, and a few modules and plugins from HTML source, the easy way is use a CSS and JS compressor like jbetolo or RokBooster.
But keep in mind that you will make a bit more hader to find your template name, but still possible via other ways. Like some images if they are not compressed in HTML.

Related

Loading resources in Laravel Valet without trailing slashes

I have a simple html file (trying to start my way with valet) and in it i have a <link rel="stylesheet" href="./css/main.css">
Thing is, home.test/app doesn't show my styled htm. Chrome's inspector shows it tries to find the resouce file at home.test/css/main.css
While in home.test/app/ it is *not* styled.
Ive been googling a cause/fix for some time and i cant wrap my head around it.
I have tried copying some of Statamic's valet driver configs without much success as a www.conf file.
Also, ive seen some rewriting methods like
rewrite ^/(.*)/$ /$1 permanent;
rewrite ^/?(.*)$ /$1 break;
also without success
I'd like to access home.test/app and have it load all required files and if possible to redirect home.test/app/ to home.test/app removing the trailing slash
The issue is likely to be down to the use of ./ in the href of the link. You're telling the server "go grab me the file from the folder /css/main.css from my current folder location.
Assuming your folder structure is:
/index.php
/css/main.css
/app/index.php
When you're on the home page, you're saying go and retrieve home.test/css/main.css. However, when in the app folder, you're telling the server to go and retrieve home.test/app/css/main.css, rather than home.test/css/main.css.
The quickest solution will be to change the link to <link rel="stylesheet" href="/css/main.css"> (getting rid of the leading .). Otherwise you can use an absolute path.

How to use version.rb plugin in Jekyll static site generator

Here is the plugin code...
module Jekyll
module VersionFilter
def versioned_url(input)
"#{input}?#{Time.now.to_i}"
end
end
end
Liquid::Template.register_filter(Jekyll::VersionFilter)
I am trying to cache bust/version control my .css file. I am new to Liquid. I am having trouble figuring out this basic plugin. Any help?
You need to put version.rb into the _plugins/ directory in the root of your Jekyll site. If you don't have a _plugins/ directory, create one.
For usage - it looks like it gives a new filter that you can apply to text - so you'd use it in your templates to filter the references to your CSS files, adding the query string so that they aren't cached - but I'm sure there's more info on that wherever you got the code from.
For what it's worth, breaking caches with querystrings isn't the best solution. It'd probably be better to write a plugin that adds a new string to the actual filename, and then adds that string to the urls where those assets are included in the templates - but that is a bit more complex.
If using an existing plugin for static asset versioning is an option for you, try jekyll-minibundle.
Assuming you keep non-stamped CSS files in _styles (note the _, because you don't want these to be exported to the production site) and want the stamped CSS files to appear in css, do the following:
<link href="{% ministamp _styles/site.css css/site.css %}" rel="stylesheet" media="screen, projection">
That works fine in combination with compass, just make compass export to _styles.

How to link assets(images,stylesheet etc) in Views for CodeIgniter 2.1?

I am using CodeIgniter Version 2.1 & trying to link assets like images,stylesheets, javascript files etc in my views by using, header.php:
<link href="<?php base_url();?>css/style.css" rel="stylesheet" />
my controller code, calls the view:
<?php
class Main extends CI_Controller{
public function index() {
$this->load->view('header');
}
The view file from which I am trying to load the asset is located
../application/views/header.php.
the css file is loaded:
../application/views/css/style.css
this does not work. I get 404 - Page not found error.then, I tried moving css/style.css outside ../application directory in webroot. To my surpise, having assets in webroot(outsite ../application/views) seems to work nicely.
Now,
My Question is
Is having our assets directly in webroot, outsite ../application directory right approach? If YES/NO, then why?
If having assets directly in webroot is a good idea, than should I move ../application/views directory in webroot as well? How?
PS: I am new to CodeIgniter framework, so unaware of the best practices
If you see this, the section where .htaccess is used to remove index.php from the urls, that has a rewrite condition:
RewriteCond $1 !^(index\.php|images|robots\.txt)
In this line, images is a folder that will be ignored while mod-rewriting. So, you can replace it by assets, put all your directly linking files there, and happily use them.
RewriteCond $1 !^(index\.php|assets|robots\.txt)
EDIT: my bad, hadn't seen the date the question was asked. nevertheless, should be useful for someone.
It is best to put your assets in the webroot folder. When requesting assest from the server (depending on your setup), it will start from the root directory and work it's way down.
http://yoursite.com/application/views/css/mystyles.css
if it's in the root you only need to go from there
http://yoursite.com/css/mystyles.css
Although it might be worth putting them all inside a folder (/assets) to keep them contained, as well as the ability to write a more effective rewrite rule (if you are trying to remove the index.php from the url) to ignore the single folder instead of all the individual folders (/css, /js, etc)
As for the views folder, it's best if you leave it in the application folder as CodeIgniter has a built in loader that automatically checks /application/views for the view file when you use the code $this->load->view('myview')
Although there are way to move the views folder, if you are new to CI it's probably best to leave it there for now.
For linking css you can do something like:
echo link_tag('css/mystyles.css');
Check this for ref: http://codeigniter.com/user_guide/helpers/html_helper.html

Remove part of URL only for certain kind of files with mod_rewrite

I need your help. I have a Joomla site working. I enabled it friendly urls and it works fine. All rewritten URLs are this way
http://mydomain.com/start/article-page-well-rewritten
When I activate Joomla Cache plugin, when I load page first time, it works fine, but afterwards, it doesn't load any css or image file.
Debugging resulting html, I realized cached file has these images and CSS links
mydomain.com/start/images/coolimage.jpg
mydomain.com/start/css/stylesheet.css
Instead of
mydomain.com/images/coolimage.jpg
mydomain.com/css/stylesheet.css
(real routes)
So I think I need a rewrite rule to remove word "start" from url, and then retrieve them and show, but only to image and css files from mydomain.com/start/
Can you help me how to do it? I don't want anything else to be rewritten...
RewriteRule ^start/(images|css)/(.+) /$1/$2 [R]

Nested URLs and Rewrite rules in Apache2

I need some help with rewrite rules and nested URLs.
I am using TikiWiki for my website and am in the process of setting up SE friendly URLs for my projects. Specifically, I have the following rewrite rule for www.example.com/projects to point to a page that lists out all the projects hosted in example.
RewriteRule ^Projects$ articles?type=Project [L]
This works fine.
Now, I would like to point www.example.com/projects/project1 to point to a specific project.
I have this rewrite rule
RewriteRule ^(Projects/Project1)$ tiki-read_article.php?articleId=6
This works, but partially. The content is all rendered as text but the theme - images/ css etc all go for a toss - the page is completely in text.
I understand that this happens 'cause the relative paths in the theme/ css/ images all refer to Projects as the base folder instead of the root of the website.
I don't want to touch the CMS portion - change the theme/ css/ image paths in the files, more for reasons of upgradability.
Can someone help me understand and write a rule so that the above nested URL works?
Regards,
Radha
You need to either change the CMS or write rewrite rules for your theme/CSS/image files. For example, if your images are in the /images/ directory within the site, try
RewriteRule ^Projects/(themes/.*)$ \1
or perhaps better
Alias /Projects/themes /themes
But still, I'd edit the CMS configuration if it were me.
Relative URLs are resolved to absolute URLs on the base of the base URL that is the current document’s URL. So in your case the base URL is /projects/project1 and not /projects although your files are actually located there. Because the client uses only URLs and has no clue about the actual file system. And the current document’s URL is /projects/project1.
So use URL references with an absolute URL path (/projects/css/…) instead of relative ones.

Resources