Difference between revisions of "Common problems when enabling Search Engine Friendly (SEF) URLs"

From Joomla! Documentation

(Remove links to pages that do no more exist.)
m (Add warning about $live_site)
 
(5 intermediate revisions by 3 users not shown)
Line 2: Line 2:
  
 
<translate><!--T:1-->
 
<translate><!--T:1-->
Enabling Search Engine Friendly (SEF) URLs can cause problems if your website hosting is not properly configured to support the re-writing of URLs. There are many different combinations of server technologies and operating systems, so it is not possible to give definitive answers to every problem with SEF URLs, however some of the more common problems are listed below.</translate>
+
Enabling Search Engine Friendly (SEF) URLs can cause problems if your website hosting is not properly configured to support the re-writing of URLs. There are many combinations of server technologies and operating systems, so it is not possible to give definitive answers to every problem with SEF URLs, however some of the more common problems are listed below.</translate>
  
<translate>==Is your server running Apache?== <!--T:2--></translate>
+
<translate>==Is Your Server Running Apache?== <!--T:2--></translate>
  
 
<translate><!--T:3-->
 
<translate><!--T:3-->
When you enable SEF URLS in Joomla! there is an option to re-write the URLs without /index.php/ which requires mod_rewrite (or the IIS equivalent) - if your server is not running Apache, or does not have the ability to rewrite URLs in this way, you will come across error messages with this option enabled. Try turning this option to 'no' and see if this method of re-writing works for you.</translate>
+
When you enable SEF URLS in Joomla! there is an option to re-write the URLs without ''/index.php/'' which requires ''mod_rewrite'' (or the IIS equivalent). If your server is not running Apache, or does not have the ability to rewrite URLs in this way, you will come across error messages with this option enabled. Try setting this option to ''no'' and see if this method of re-writing works for you.</translate>
  
 
<translate><!--T:4-->
 
<translate><!--T:4-->
Also make sure that you have a 'Directory' section in your Apache config file that allows .htaccess overrides, otherwise the .htaccess file in your Joomla! root directory WILL BE IGNORED. The directive needed is:</translate>
+
Also make sure that you have a ''Directory'' section in your Apache config file that allows ''.htaccess'' overrides, otherwise the ''.htaccess'' file in your Joomla! root directory '''will be ignored'''. The directive needed is:</translate>
  
 
   AllowOverride all
 
   AllowOverride all
  
<translate>==Is your server running IIS?== <!--T:5--></translate>
+
<translate>==Is Your Server Running IIS?== <!--T:5--></translate>
  
 
<translate><!--T:6-->
 
<translate><!--T:6-->
Line 23: Line 23:
 
* [[IIS7 and SEF URLs using Joomla 1.5x]]</translate>
 
* [[IIS7 and SEF URLs using Joomla 1.5x]]</translate>
  
<translate>==Did you clear your cache?== <!--T:7--></translate>
+
<translate>==Did You Clear Your Cache?== <!--T:7--></translate>
  
 
<translate><!--T:8-->
 
<translate><!--T:8-->
When you make any changes to SEF settings it is advisable to make sure that you clear your cache, and if you are caching URLS (for example using a third-party SEF extension) make sure that you change any settings there, and purge cached URLs if necessary.</translate>
+
When you make any changes to SEF settings make sure that you clear your cache. If you are caching URLS (for example, using a third-party SEF extension), make sure that you change any settings there, and purge cached URLs.</translate>
  
<translate>==Have you moved domains?== <!--T:9--></translate>
+
{{note|<translate>
 +
<!--T:55-->
 +
'''Note!''' The following information relates to old, outdated and unsupported versions of Joomla! and used entirely at your own risk!</translate>|type=serious}}
 +
 
 +
<translate>==Have You Moved Domains?== <!--T:9--></translate>
  
 
<translate><!--T:10-->
 
<translate><!--T:10-->
Sometimes if you have changed domains (for example from a localhost or test environment to the live domain) you will need to edit the value for the <code>$live_site</code> variable in the configuration.php file found in the root directory of your Joomla site files. The value of the variable must be manually edited, it cannot be accessed via the Global Configuration screens.</translate>
+
Sometimes if you have changed domains (for example, from a localhost or test environment to the live domain), you will need to edit the value for the ''$live_site'' variable in the ''configuration.php'' file found in the root directory of your Joomla site files. The value of the variable must be manually edited, it cannot be accessed via the Global Configuration screens.  See [https://forum.joomla.org/viewtopic.php?f=811&t=998357 Leave $live_site=<nowiki>''</nowiki> in configuration.php] for more information.</translate>
  
 
<translate><!--T:11-->
 
<translate><!--T:11-->
 
Typically, it would look like:</translate>
 
Typically, it would look like:</translate>
<source lang="php">
+
<syntaxhighlight lang="php">
var $live_site = 'http://example.com';
+
var $live_site = 'https://example.com';
</source>
+
</syntaxhighlight>
  
 
<translate><!--T:12-->
 
<translate><!--T:12-->
Or, if you access your website in a sub-folder called joomla, it would be like this:</translate>
+
Or, if you access your website in a sub-folder called ''joomla'', it would be like this:</translate>
<source lang="php">
+
<syntaxhighlight lang="php">
var $live_site = 'http://example.com/joomla';
+
var $live_site = 'https://example.com/joomla';
</source>
+
</syntaxhighlight>
  
 
<translate><!--T:13-->
 
<translate><!--T:13-->
 
When you move domains, this value may need updating to reflect your new domain name:</translate>
 
When you move domains, this value may need updating to reflect your new domain name:</translate>
<source lang="php">
+
<syntaxhighlight lang="php">
var $live_site = 'http://mynewdomain.com';
+
var $live_site = 'https://mynewdomain.com';
</source>
+
</syntaxhighlight>
  
 
<translate><!--T:14-->
 
<translate><!--T:14-->
Often, there is no need to specify this variable at all - in which place simply leave it blank:</translate>
+
Often there is no need to specify this variable at all. Simply leave it blank:</translate>
<source lang="php">
+
<syntaxhighlight lang="php">
var $live_site = '';
 
</source>
 
 
 
Often, there is no need to specify this variable at all - in which place simply leave it blank:
 
<source lang="php">
 
 
var $live_site = '';
 
var $live_site = '';
</source>
+
</syntaxhighlight>
 
 
<translate><!--T:15-->
 
* See [http://www.scribd.com/doc/2300167/Joomla-v-15-Configure-and-troubleshoot-SEF-URLs Scribd] by [[GHOP students/Benjamin Hättasch|Benjamin Hättasch]] which contains step-by-step instructions for installing and trouble-shooting your SEF URLs.</translate>
 
  
 
<noinclude>
 
<noinclude>

Latest revision as of 22:28, 19 May 2023

Other languages:
English • ‎français • ‎português do Brasil

Enabling Search Engine Friendly (SEF) URLs can cause problems if your website hosting is not properly configured to support the re-writing of URLs. There are many combinations of server technologies and operating systems, so it is not possible to give definitive answers to every problem with SEF URLs, however some of the more common problems are listed below.

Is Your Server Running Apache?[edit]

When you enable SEF URLS in Joomla! there is an option to re-write the URLs without /index.php/ which requires mod_rewrite (or the IIS equivalent). If your server is not running Apache, or does not have the ability to rewrite URLs in this way, you will come across error messages with this option enabled. Try setting this option to no and see if this method of re-writing works for you.

Also make sure that you have a Directory section in your Apache config file that allows .htaccess overrides, otherwise the .htaccess file in your Joomla! root directory will be ignored. The directive needed is:

 AllowOverride all

Is Your Server Running IIS?[edit]

If you are using IIS check out these links which may be useful:

Did You Clear Your Cache?[edit]

When you make any changes to SEF settings make sure that you clear your cache. If you are caching URLS (for example, using a third-party SEF extension), make sure that you change any settings there, and purge cached URLs.

Note! The following information relates to old, outdated and unsupported versions of Joomla! and used entirely at your own risk!

Have You Moved Domains?[edit]

Sometimes if you have changed domains (for example, from a localhost or test environment to the live domain), you will need to edit the value for the $live_site variable in the configuration.php file found in the root directory of your Joomla site files. The value of the variable must be manually edited, it cannot be accessed via the Global Configuration screens. See Leave $live_site='' in configuration.php for more information.

Typically, it would look like:

var $live_site = 'https://example.com';

Or, if you access your website in a sub-folder called joomla, it would be like this:

var $live_site = 'https://example.com/joomla';

When you move domains, this value may need updating to reflect your new domain name:

var $live_site = 'https://mynewdomain.com';

Often there is no need to specify this variable at all. Simply leave it blank:

var $live_site = '';