Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Tuesday, April 2, 2019

Joomla SEF URL Problems [SOLVED 404 Error]

Hello Everyone, 

Recently my team and I worked and delivered a small Joomla website. After the site went live, I turned ON the SEF URL from the backend. But the URLs was still non-search engine friendly. I started to troubleshoot, finally, it started to work. I decided to document the steps through which it worked for me and the following are the steps. My intent is to educate.

Please note,
  • These steps are for an Ubuntu machine running Apache2 and I am using Joomla  3.X
  • Application is hosted at folder /var/www/html/JoomlaApp/
  • Demo URL for my site will be http://siteurl.com/JoomlaApp/


Preliminary checks or requirements 



  1. MOD_REWRITE: Very first step is to make sure mod_rewrite is enabled. By use of phpinfo(); one can verify if it is enabled or not. If it does not then use the command
    sudo a2enmod rewrite and then restart the web server.


  2. Rename htaccess.txt: Joomla provides its users with a default htacess.txt file. In order to enable SEF URL's this file needs to be renamed to .htaccess


  3.  Apache Configurations: The apache configuration needs to change so that it allows URL rewrites. I made changes for both HTTP & HTTPS configuration that is port 80 & 443.
    1. /etc/apache2/sites-available/000-default.conf
      • <VirtualHost *:80>
      • ServerAdmin webmaster@localhost
      •         DocumentRoot /var/www/html
      •         <Directory "/var/www/html">
      •         AllowOverride All
      •         </Directory>
    2. /etc/apache2/sites-available/default-ssl.conf
      • <VirtualHost _default_:443>
      •          ServerAdmin webmaster@localhost
      •         DocumentRoot /var/www/html
      •         <Directory "/var/www/html">
      •         AllowOverride All
      •         </Directory>


  4. Joomla Admin Configuration change
    1. Log into Joomla Admin console
    2. Go to System > Global Configuration  
    3. Locate SEO Settings and set the Use URL Rewriting option to Yes










As per Joomla documentation, the above steps should enable the SEF URL for your website, if it doesn't work then follow are the troubleshooting steps.

  1. Apache Configuration: As a habit, I copied the AllowOverride All code directly from the net and pasted it on the Apache configuration file. Which was a mistake. Apache configuration is very particular about the double quotes. "".  Hence please type it, do not copy paste it.


  2.  I made the following changes to my .htaccess file.
    1. Uncommented       # RewriteBase /      to        RewriteBase /

    2. My Joomla application exists inside another directory, like /var/www/html/JoomlaApp/. So I made the following change on Rewite Base
      1. RewriteBase /JoomlaApp/

    3. Added following piece of code after RewriteEngine On
      • ## Mod_rewrite in use.

      • RewriteEngine On
      • RewriteCond %{HTTP_HOST} ^siteurl.com/JoomlaApp/ [NC]
      • RewriteRule ^(.*)$ http://siteurl.com/JoomlaApp/$1 [L,R=301]

    4. Finally added following line of code at the very end of the file.
      • RedirectMatch 301 ^/index.php/(.*)$ http://siteurl.com/JoomlaApp/$1


  3. Another change I made was to the configurations.php file. I initialized the Live site variable as following, I am not sure, how helpful this particular change was, but it is there in the mix.
    • var $live_site = 'http://siteurl.com/JoomlaApp'; 


With all the above changes, the URL SEF for Joomla started to work for me. Please feel free to ask me any questions.

Thanx
Anshumaan Bakshi

Wednesday, June 24, 2015

SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1

Hello,

Got this error message

SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1

We tried everything to insert in one table but this error didn't budged even for the simplest query we  wrote.

Then I found that there was a "TRIGGER" applied on this table which on insertion updates another table.

So the problem was with the stored procedure. There was some additional field in it.

I discovered the root cause as soon as I deleted the Trigger.

So the issue was with the error message, this error was not pin pointing that the field was missing on which table, due to the language of the error it seems like the error is with the immediate table but actually it can be with a connected one.

Hope this will help someone.

Thanx
Anshumaan Bakshi


Monday, April 27, 2015

Connection Failed: 'host' is not allowed to connect to this mysql server

Hello,

If you are getting following error while trying to connect your (PHP) application to a MySQL database

Connection Failed: 'host' is not allowed to connect to this MySQL server

Then this may due to limited privileges given to the user through which one s trying to connect with the server. Although a correct username and password is been used to connect still we have this error.

What happens is when a new MySQL user is added to a DB then the hostname name like localhost is added by default to user like user1@localhost. Now this user can access the DB for sure but while he is on the same machine not remotely.

The solution for this issue is to create a new user which has Any Host privileges "%" like

mysql> CREATE USER 'user2'@'%' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'user2'@'%' -> WITH GRANT OPTION;


Thanx
Anshumaan Bakshi

Monday, December 23, 2013

ERROR 2006 (HY000) at line 8245: MySQL server has gone away

Hello,

If you are trying to import an SQL file through command line on windows and you get this error message

ERROR 2006 (HY000) at line 8245: MySQL server has gone away

then you need to open your my.cnf or my.ini and update as

max_allowed_packet = 3000M

more than the size of the file you are trying to import, like I was trying to import a 2.2 GB file.

Thanx
Anshumaan Bakshi

Wednesday, November 20, 2013

WAMP phpMyAdmin error #2002 - No connection could be made because the target machine actively refused it.

Hello,

If you get an error #2002 - No connection could be made because the target machine actively refused it when you try to access phpmyAdmin on a WAMP.

Then it is due to your 3306 port is already occupied by some other application. For me it was Skype today, I just needed to close Skype and restart the WAMP server once again and the issue was fixed. Skype will anyways take another vacant port so restart it as well.

You can make changes to my.ini so that it listens to another port, but easier to close Skype.

Try it.

Thanx
Anshumaan Bakshi