*

Pharg

  • *****
  • 2,065
  • osDate Version: osDate Evo v1.0
osDate Search-Engine Friendly URLs
« on: January 09, 2015, 07:36:42 AM »
osDate Search-Engine Friendly URLs

If you are using the Apache web server with the mod_rewrite extension enabled, you may wish to enable Search Engine Friendly URLs (SEF URLs) with osDate. This will improve your ranking on Google and other search engines.

Step 1: Ensure that mod_rewrite is enabled.

To check to ensure that mod_rewrite is enabled for your domain, create a single PHP file with the following contents:

<?php
phpinfo();
?>
You can create this file using any good text editor, like Textpad. Upload it to your web server and access using a web browser. You should see a blue/gray screen showing your server's PHP configuration. Do a quick search on the page for "mod_rewrite". If present in your Apache Loaded Modules row, then you can use SEF URLs. If this is not present, check with your web host to determine if mod_rewrite is enabled. It may still be present even if the Loaded Modules line is not visible.
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

*

Pharg

  • *****
  • 2,065
  • osDate Version: osDate Evo v1.0
Re: osDate Search-Engine Friendly URLs
« Reply #1 on: January 09, 2015, 07:39:05 AM »
Step 2: Upload .htaccess to your osDate root

In the osDate "SEF_URLs" folder, there is a file called ".htaccess.txt". Open this file with a good text editor, like Textpad, and edit the "RewriteBase ..." line to correspond to the docroot variable in config.php. You can ignore lines beginning with "#" as those are comments.

For example:

http://www.domain.com/demo/osdate/

This is what my .htaccess.txt file looked like after editing:
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

*

Pharg

  • *****
  • 2,065
  • osDate Version: osDate Evo v1.0
Re: osDate Search-Engine Friendly URLs
« Reply #2 on: January 09, 2015, 07:40:29 AM »
Now, rename this file to ".htaccess", and upload it to your osDate root folder. Do NOT upload to the SEF_URLs folder, upload to your osDate root folder! I.e., the same folder where config.php is located.
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

*

Pharg

  • *****
  • 2,065
  • osDate Version: osDate Evo v1.0
Re: osDate Search-Engine Friendly URLs
« Reply #3 on: January 09, 2015, 07:41:44 AM »
Step 3: Enable URL Rewriting in Admin

Now, login to the osDate admin panel, and choose the SEO Settings at the left navigation menu. Enable URL Rewriting, then click "Save Changes".
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

*

Pharg

  • *****
  • 2,065
  • osDate Version: osDate Evo v1.0
Re: osDate Search-Engine Friendly URLs
« Reply #4 on: January 09, 2015, 07:42:52 AM »
Now, profile links will be .htm links rather than .php?id=.. links, as shown below.
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

*

Pharg

  • *****
  • 2,065
  • osDate Version: osDate Evo v1.0
Re: osDate Search-Engine Friendly URLs
« Reply #5 on: January 09, 2015, 07:43:34 AM »
Starting with the osDate 1.0 final, other pages, like the bottom-most links of the homepage.tpl template, have also been made search-engine friendly. The Privacy link at the bottom changes to "privacy.html", Terms of Use changes to "terms_of_user.html", and so on. Later versions of osDate will likely support an even greater degree of URL rewriting.

The .htaccess rewrite rules for the bottom-most links are:

RewriteRule ^privacy.html$ index.php?page=privacy
RewriteRule ^terms_of_use.html$ index.php?page=terms_of_use
RewriteRule ^services.html$ index.php?page=services
RewriteRule ^faq.html$ index.php?page=faq
RewriteRule ^articles.html$ index.php?page=articles

These are provided in the .htaccess.txt file within the SEF_URLs folder.

In the Smarty templates, the mod rewrite option is checked using the following {if} clause:

{if $config.enable_mod_rewrite == 'Y'}


    <a href='privacy.html' class='footerlink'>{$lang.site_links.privacy}</a> |&nbsp;
    <a href='terms_of_use.html' class='footerlink'>{$lang.site_links.terms_of_use}</a> |&nbsp
    <a href='services.html' class='footerlink'>{$lang.site_links.services}</a> |&nbsp;
    <a href='faq.html' class='footerlink'>{$lang.site_links.faq}</a> |&nbsp;
    <a href='articles.html' class='footerlink'>{$lang.site_links.articles}</a> |&nbsp;

{else}

    <a href='index.php?page=privacy' class='footerlink'>{$lang.site_links.privacy}</a> |&nbsp;
    <a href='index.php?page=terms_of_use' class='footerlink'>{$lang.site_links.terms_of_use}</a> |&nbsp;
    <a href='index.php?page=services' class='footerlink'>{$lang.site_links.services}</a> |&nbsp;
    <a href='index.php?page=faq' class='footerlink'>{$lang.site_links.faq}</a> |&nbsp;
    <a href='index.php?page=articles' class='footerlink'>{$lang.site_links.articles}</a> |&nbsp;

{/if}
Thus, if you wish to add additional URL rewriting, it's easy to do by checking for the $config.enable_mod_rewrite global configuration option.
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35