I'm using Joomla 3.4.5 with SEF and .htacess with cache on.
The image URLs in modules and content are being incorrectly rendered. Sometimes, they are correctly displayed and some other times the following happens:
Instead of rendering:
www.domain.com/images/image.jpg
It is rendering:
www.domain.com/menu_item/images/image.jpg
I'm not sure why this is happening and if it is related wiht .htaccess or SEF, cache or everything.
I'm using the following custom redirects:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteEngine On
RewriteRule ^item/(.+)$ /artigos/$1 [R=301,L]
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
Which I tried to comment out to check if it helped, but no luck.
Help anyone?
its about the image path.
for example:
/images/image1.jpg
refers to image in /website-rootfolder/images/image1.jpg
but
images/image1.jpg
refers to: currentUrl/images/image1.jpg
So with slash it means: load image from /root
without slash it means: load image from /current url
hope it helps ;)
So for ur example:
www.domain.com/menu_item/images/image.jpg = images/images/image.jpg
just add the remaining slash / (/images/images/image.jpg) and your image on the page is getting loaded from:
www.domain.com/images/image.jpg
In your backend, go to:
Components -> JCE Editor -> Editor Profiles -> Default-> Editor Parameters
and make sure that:
"File Directory Path" is set to "images" (without the quotes).
Save it and then clear your Joomla cache.
If that still doesn't work, then maybe the ordering of your plugins is wrong. Check this post we have written about 4 years ago (it is very old, but it is still valid): http://www.itoctopus.com/images-not-appearing-on-your-joomla-website .
Hope this helps!
Related
I've installed Laravel October CMS. When I access http://localhost/index.php/backend, I can see the loging page of the backend. When I access http://localhost/backend I've 404 Not Found.
I've taken a look to .htaccess, I've uncommented the RewriteBase and set the value / /index.php.
However it still returns a 404. Do you know why?
I believe you are simply looking for following Rule based on your shown samples. Also please make sure you clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteRule ^backend/?$ index.php [NC,L]
In case this is the only rule of your htaccess file then change L to END in above.
I use .htaccess to rewrite url from someurl.com/ to someurl.com/public/. First .htaccess in www root contains this:
DirectoryIndex ./public/
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ ./public/$1 [QSA]
and second one in folder /public/ contains this:
DirectoryIndex _main.php
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ ./?params=$1 [QSA]
And the problem is when I open url someurl.com/ without "public". Page is loaded correctly, but in Google Chrome console I got error: net::ERR_INCOMPLETE_CHUNKED_ENCODING. When I open url someurl.com/public/ page loads without any error.
Any ideas, please?
In my case, the problem was cache-related and was happening when doing a CORS request.
I post my response here cause this is the first resource I found on Google for net::ERR_INCOMPLETE_CHUNKED_ENCODING error.
Forcing the response header Cache-Control to no-cache resolved my issue:
[ using Symfony HttpFoundation component ]
<?php
$response->headers->add(array(
'Cache-Control' => 'no-cache'
));
I had this issue when trying to access some parts of the WP admin area, I managed to resolve it by adding the below to my functions.php file;
add_filter('wp_headers', 'wpse167128_nocache');
function wpse167128_nocache($headers){
unset($headers['Cache-Control']);
return $headers;
}
We had net::ERR_INCOMPLETE_CHUNKED_ENCODING problem in case of HTML, which contained too much empty lines. Some browsers had difficulties with interpretation of long files.
Once we made applied code cleaning in our templates by cleaning code from empty lines, all was perfect.
I was also facing same issue. Finally i got this was the permission issue on cache folder.
I decided changing the file : /etc/apache2/mods-enabled/cgid.conf
Adding the following code snippet:
<IfModule mod_cgid.c>
CGIDScriptTimeout 60
</IfModule>
This problem is really general, in my case I deactivated the WP Super Cache plugin, and didn't get the bug anymore, but this is so general that no one can really help you because of different configurations of servers/wordpress
In my case, the problem was the Windows anti-virus software (Kaspersky). Turning it off, the problem was gone :/
For me it was the Zend PHP Opcache. It had reached its memory limit and could no longer cache all scripts. This was a problem for a massive code base like Magento 2.
Increasing the memory limit solved the issue after weeks of banging head on desk.
It is about server side problem.
The user has running web service does not right access to web server cache folder.
Make sure nginx user can write to /var/lib/nginx (or /var/cache/nginx in some distros).
Make sure nginx user can write to the folder (find the nginx user form nginx configuration file is located usually in /etc/nginx/nginx.conf)
Give the right access (chown -R nginx:nginx /var/lib/nginx/)
Reload the service(-service nginx reload -in centos)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA
Looking for feedback
Goal: I am trying to enable "Clean URLs" on a Drupal 7 site (such that example.com/?q=user resolves to example.com/user).
I've just spent way too long pouring through official Drupal docs and comments, to no avail, so any suggestions are greatly appreciated!
I have checked the box "Enable Clean URLs" in Drupal (/admin/config/search/clean-urls) and got the all-clear that the configuration options were saved. So now I am actually able to go to example.com/user and it does indeed display the same content as example.com/?q=user. What I want, however, is for example.com/?q=user to be rewritten in the URI as example.com/user.
The relevant .htaccess code is shown above, and my Apache conf appears to be properly configured.
Clean urls do indeed work but I kept getting errors until I found this
This saved my sanity:
disable Overlay module
go to Clean URLS
change URL from: /?q=admin/config/search/clean-urls
to: /admin/config/search/clean-urls
Then the Check box should appear
I was searching for this issue, the solution that work for me was that:
Left click on the wamp server icon and go to the apache.
Here sub menu will be opened, go to the apache modules and enable the rewrite_module.
now restart wamp server and then check your site.
Enable clean url will now be active.
there should be a closing bracket on your last line "]". Perhaps this is the source of your frustration?
EDIT
After a comment from Seth below, and heading to a helpful apache page here, I have found that VirtualHosts are the way to go for the following issue.
/edit
--ORIGINAL POST--
First, a little background on file setup. I am running a LAMP server that hosts multiple domains. I have staging and live sites on this server, under different directories under the web root.
examples
/webroot/live/site1/[public files]
/webroot/live/site2/[public files]
/webroot/stage/site1/[public files]
/webroot/stage/site2/[public files]
The domains for each of these go to the IP of the server, which points at the webroot directory. I have an .htaccess file there to load the appropriate content based on the http_host.
examples
RewriteCond %{HTTP_HOST} ^www.site1-live.com [NC]
RewriteRule ^(.*)$ /live/site1/$1 [PT,L,QSA]
RewriteCond %{HTTP_HOST} ^www.site1-stage.com [NC]
RewriteRule ^(.*)$ /stage/site1/$1 [PT,L,QSA]
These work great for hitting the home page and any of the internal pages, even with the specific pages being like site1-live.com/view/123. Each site's htaccess handles those.
My issue (sorry it took so long to get here):
When I head to any subdirectory within a site, like www.site1-live.com/rss, the content loads just fine, but the URL changes to something like the following
http://www.site1-live.com/live/site1/rss/
Essentially showing the path from the webroot to the files.
How can I avoid this? I obviously want the url to remain www.site1-live.com/rss. Do I need an htaccess file inside the rss directory to block this somehow?
Thanks in advance!
replace ^www with ^(.*)
then have the whole url in the second line www.yourdomain.com/live/...
Doug,
why do you need the QSA flag?
Anyway, what is happening to you is that mod_index (or whatever is serving you directories) is redirecting you www.site1-live.com/rss (without the ending /) to the equivalent URL with the ending /.
If you don't use mod_alias or something list that on the rewritten URLs, removing the PT should work as you expect.
Here's a problem I'm always wanting to solve with htaccess. I haven't found a way yet, though it looks like it should be possible - perhaps someone can help.
Let's say I have a folder at the root of my site called /foo/. I want users to be able to access that folder at the path /bar/, but for various reasons I can't rename the folder.
So as not to create confusion I only want one path to ever be seen - that is to say, I don't want people to use the name /foo/ to access the folder; they should always use /bar/. If someone goes to example.com/foo/, their browser should redirect to example.com/bar/ - but the content returned should be the content of /foo/.
To make matters more complicated, pages in /foo/ have dependencies (images, stylesheets, links to other pages, etc) within /foo/ which are hardcoded and can't be changed. These must, of course, still work.
So, to summarise, this is what I want :
Requests for example.com/foo/ should redirect to example.com/bar/.
Requests for example.com/bar/ should return the contents of example.com/foo/.
Is this possible? It looks on the surface as if it would create an infinite redirect... but I'm pretty sure there are ways to prevent that in htaccess, aren't there?
I'd be very grateful for any help.
(PS - for a little extra background: The normal reason I want to do this is to rename the wordpress /wp-admin/ directory to something more professional and easy for customers to remember, such as /admin/. But the same system should work for masking any path in this way.)
I found a sort of workaround - by using a symlink and htaccess in combination.
First I created a symlink from /bar to /foo/.
Then I put this in htaccess :
Options +FollowSymLinks
RewriteRule ^foo/(.*)$ bar/$1 [R,L]
This has exactly the desired result - example.com/bar/ shows the content of the /foo/ directory, and example.com/foo/ redirects to example.com/bar/
But if anyone can come up with a pure htaccess solution I'd much prefer that!
Update :
Ok, I've finally found out how to do this. It turns out to be quite simple...
RewriteCond %{THE_REQUEST} ^GET\ /foo/
RewriteRule ^foo/(.*)$ bar/$1 [R,L]
RewriteRule ^bar/(.*)$ foo/$1
The only problem is that it doesn't take account of RewriteBase, so you have to include the full path in the first line (after ^GET\).
If I understand correctly what you want is something like this inside your .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^foo/$ bar/
RewriteRule ^bar/$ foo/
</IfModule>