Joomla 404 error only on article content with SEF link - .htaccess

I have installed a website made with joomla on a new linux CentOS6 server.
I have installed and configured Apache
Installed and Configure PHP
Installed and configured MySQL
Installed PhpMyAdmin
Installed and Configured FTP
Set the firewall rules
Everything is working right, except the single article pages:
The web site is accessible from outside The user is under the group
www-data and has read-write permission on all the folders I can
upload media to the website and this has the right privileges once uploaded
FTP is working perfectly
httpd.conf has the permission to AllowOverride All to the directory where the site is (/var/www/sites/clientname/sitename.it )
When I start httpd, I get no error or warning.
if I try to access to the following URL I get 404:
http://ldgsocial.brainsen.com/index.php/test
that it's a page configured as "single article", pointing to a published article.
The article is not even accessible typing the real URL:
http://ldgsocial.brainsen.com/index.php?option=com_content&view=article&id=110
The record with id=110 is present in the database, and visible in the list of articles in Joomla Admin.
All the folders of joomla are readable and writable.
SEF is activated, I've tried to deactivate but both above URL return always 404
mod_rewrite is loaded
the htaccess.txt is renamed after the FTP upload to .htaccess
in the .htaccess I have the following directives:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /var/www/sites/clientname/sitename.it
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
I've tried also putting:
RewriteBase /var/www/sites/clientname/sitename.it/public_html
and
RewriteBase /
but nothing to do.
The articles are accessible only if I create a new menu voice with type Category List.
From there all the articles are accessible and correctly displayed.
I'm pretty desperate as I don't know what to do next...
here is the installation details:
database Version 5.1.69
Collation database utf8_general_ci
PHP Version 5.3.3
Web Server Apache/2.2.15 (CentOS)
Joomla! Version Joomla! 2.5.14 Stable [ Ember ] 01-August-2013 14:00 GMT
Joomla! Platform Version Joomla Platform 11.4.0 Stable [ Brian Kernighan ] 03-Jan-2012 00:00 GMT

jdog, thanks, you have given me the input!
The problem was on the server system date, that was wrong and set to the past.
So the articles was published, because was set on a different server, but on the new server, they were not shown as they publishing date was future to the system date..

Related

WordPress Cannot save Permalink shows 404 error

I have hosted a domain in Linux Apache 2.4.16 web server and installed WordPress in it. Now I cannot update Permalink from default (date/time/%postname%/) to /%postname%/ or custom structure. Only Plain type gets saved. I am getting 404 error.
404 Page not found
I have cleared everything in the server contents, posts, plugins, even ssl too and remove and install WordPress,... But I am still getting the same error.
Any suggestions?
Seems all the things you did are correct in this context. Have you checked whether the mod_rewrite module is on in Apache. You can check that by writing the phpinfo function in a file at your server.
Check Screenshot
Read
Give permission to .htaccess file. Through Linux command line. At first navigate to the project folder,
cd /var/www/html/project-folder
Then give 777 permission to .htaccess file. By this below command,
sudo chmod -R 777 .htaccess
Then edit .htaccess file with the below code.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
And then update the permalink settings 2 times from the wordpress admin panel.

htaccess redirect, everything is redirecting instead of specific requests

I'm trying to setup a new project structure. Due to some limitations of my cloud provider, I need to do some htaccess magic which I'm struggling with.
The project structure is as following
/docroot => Contains my Drupal installation
/docroot/frontend => Contains an Angular frontend
/docroot/pim => Is a symlink to /docroot.
What we need is that when we surf to example.com/pim that it redirects to the Drupal docroot /docroot. Since due to limitations of the cloud provider we can't put it in the /pim folder, they suggested to make a symlink.
Any other request to example.com should go to docroot/frontend.
So I've added the following code in my htaccess file
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/frontend.*$
RewriteRule !^pim($|/) http://example.com/frontend%{REQUEST_URI} [L,R=302]
Current behaviour is that all requests go to /frontend/index.php (I think the index.php comes from the .htaccess of Drupal, so the redirect is not done cleanely) While I would expect a request to example.com/test to direct to example.com/frontend/test
Also example.com/pim points to example.com/frontend/index.php instead of staying in the /pim directory
I've been able to fix it. :)
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/frontend.*$
RewriteCond %{REQUEST_URI} !^/pim.*$
RewriteRule ^ frontend%{REQUEST_URI} [L,R=302]
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/frontend.*$
RewriteRule ^ %{REQUEST_URI} [L]

Laravel 4.2 project not working after uploading - public folder not visible in browser

I've created a laravel project which is working fine on localhost and my hosting server but when I upload it on my client's server it just doesn't work (he's using bluehost).
When I open the URL which is pointing to /public folder, it should display the homepage. Instead it is showing the listing of all files and folders (except public folder).
When I try to open myurl.com/public or myurl.com/public/index.php in browser, it gives following error:
Forbidden
You don't have permission to access /license/public/ on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
I can see public folder via FTP and I've changed permissions for /app/storage to 777
Here is my public/.htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I've checked my /public/error_log, its showing following error:
[21-Aug-2015 09:06:01] PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required '__DIR__/../bootstrap/autoload.php' (include_path='.:/usr/lib64/php:/usr/share/pear') in /home6/parentv3/public_html/eldercareapp/license/public/index.php on line 21
Any help?
Well the problem is with your PHP version. If you see your PHP Version, you might get what is wrong with your application. You must use version greater than PHP 5.5
Ok, I had contacted client's hosting company and asked them to upgrade PHP version. They took a couple of days and upgraded PHP to 5.5.
But the problem was still there even after updating PHP. I wasn't able to access /public folder so the problem was somewhere else. After some searching and trying I've found a solution.
The problem was actually in my /public/.htaccess file. I've added just one line in my .htaccess and it solved the problem: Options +FollowSymLinks
My updated .htaccess in /public now looks like:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
Options +FollowSymLinks
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Cheers
Changing permissions to 777 is a terrible idea because it will be vulnerable, instead try with sudo chmod -R 775 project/ where project is the name of your project's folder, then do the next sudo chown -R $USER:$USER project/ to make the project's folder be owned by your user, finally, if you haven't done it, cd into the project's folder and run composer install

having headache wtih codeigniter mod_rewrite ~!

I read lots of the mod_rewrite for codeigniter and lots of them were talking about creating a .htaccess file and inside the file with something like
I'm a beginner with codeigniter so I'm learning from youtube tutorials.
at first I only have apache 2.2 installed to run my php and after using codeigniter with mod_rewrite I realize it's easier to install wamp so I uninstalled apache, mysql then installed wamp which has everything.
After that I continued with the tutorial on youtube about mod_write. I activated the module in wamp.
Created this .htaccess file inside ci_intro which is the root folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ci_intro/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
I went to the config/config.php and changed
$config['index_page'] = '';
things didn't work. I was getting the 404error then I was trying out few things in
RewriteBase /ci_intro/
and also even deleted the whole project and because I backed things up right before I try the mod_write. Even after I retrieved the backup. I still didn't get the error404 page.
I just keep on getting..
Since I'm using wamp, when I go to my localhost there's a section saying my project which is ci_intro...I click on it the image above comes out.
I put my mouse over to check what's the link showing when mouse over and the link shows
[CODE]http://localhost/ci_intro[CODE]
anyone know what's going on here?
That browser page you are getting, is a result of using a fake or unregistered domain-name... The browser is unable to resolve it to an IP address, so it "helps" you by reinterpreting your request as a search term.
This is happening because you are using "www.domain.tld" instead of "localhost" to access your website.
I'm not sure which WAMP distrubution you are using (there are many "WAMPs"), but your options are:
A) Edit the Windows Hosts file (C:\Windows\system32\drivers\etc\hosts) to locally resolve "www.domain.tld" to the local IP addres 127.0.0.1 (and make sure your VirtualHost or Server has that domain name as part of it's ServerName directive).
B) Use "localhost" instead... http://localhost/
C) Use a WAMP that automatically sets up website VirtualHosts for you and has a LocalDNS feature like Wamp-Developer Pro does - so none of the above matters.
Now once you get passed that, there might be some other issues... I'm guessing that .htaccess file should be in the DocumentRoot folder itself.

Htaccess rule to make urls like this ?page=1 look like /page/1 in Codeigniter

This is how my urls currently look:
http://mysite.com/?page=1
How can I make this work?:
http://mysite.com/page/1
There is a post on StackOverflow that asks the same question. But the accepted solution isn't working for me. Because I am using Codeigniter and my page results in a 404 perhaps because since the url pattern of a CI site is:
domain/controller/method
The system is assuming that I am requesting a controller called "page" and a method called "1" both of which of course doesn't exist. Or maybye it's due to a conflict with the other code in my htaccess file (which I downloaded from the CI wiki, it gets rid of index.php and does a few security things). Here is my entire htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users. Additionally this will allow you to create a System.php controller, 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder. This snippet prevents user access to the application folder. Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file, such as an image or css document, if this isn't true it sends the request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
#Pretty urls for pagination links
RewriteRule (.*) index.php?page=$1
</IfModule>
The non indented bit is the solution I got from that other SO question that isn't working for me.
Any solutions to this CI pagination issue?
UPDATE
Ok, read some of the docs and now I have this working:
http://mysite.com/home/index/2
What would be the htaccess rule to turn that into?:
http://mysite.com/page/2
You should make this configuration at /application/config/routes.php (and let the .htaccess just for hide the index.php as you are already doing).
$route['page/(:any)'] = 'home/index/$1';
Or better, like #zaherg remembered (ensures that only numbers could by matched):
$route['page/(:num)'] = 'home/index/$1';
This way all the requests to http://mysite.com/page/2 will be treated internally as http://mysite.com/home/index/2 and so forth.
I suggest you take a look at CodeIgniter User Guide - URI Routing and CodeIgniter User Guide - Tutorial − Introduction.
Good luck.
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
from CodeIgniter docs
That will handle removing the index.php, but what happens after that depends how CodeIgniter's query string handling is set up: it can be configured to use a query string rather than a path. See the link for more details.

Resources