Understand and Enable Search Engine Friendly (SEF) in Joomla

Search Engine Friendly(SEF) also known as human readable URL. With the most famous Web Service like Nginx, Apache and IIS7, they do support URL rewrite or mod_rewrite to rewrite the human readable URL such as www.domain.com/about instead of www.domain.com/about.html.

With Joomla 1.5 and above, Joomla come with 3 option from your Global Configuration.
–  Search Engine Friendly URLs – With this option enabled, SEF will enable and your URL will look like, http://www.example.com/index.php/the-­news/1-­latest­-news/1­-welcome­-to­-joomla.
– Use Apache mod_rewrite/URL rewriting – With this option enabled, mod_rewrite will eliminate inde.php and your URL will look like, http://www.example.com/the-­news/1­-latest-­news/1-­welcome-­to­-joomla
– Add suffix to URLs – With this option enabled, your URL will added .html at the end of the URL and it will look like http://www.example.com/the-­news/1­-latest-­news/1-­welcome-­to­-joomla.html

To enable SEF with Nginx, add the following line to your (vhost)nginx.conf file.

# Support Clean (aka Search Engine Friendly) URLs</tt>
        location / {
                try_files $uri $uri/ /index.php?q=$request_uri;

To enable SEF with Apache server, you may easily rename the htaccess.txt to .htaccess file. This step is not necessary as you may get your .htaccess file generated if it is install in  own folder.

With IIS 7, you may choose to use GUI or directly add it from web.config file.

With GUI interface, you may add the following option from the URL rewrite option.

Pattern field: ^([^/]+)/?$
Ignore case ON
Action type: Rewrite
Rewrite URL: index.php/

 Otherwise, you may add the following line to your web.config file.

<?xml version="1.0" encoding="UTF-8"?>
                <clear />
                <rule name="Common Exploit Blocking" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" />
                        <add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" />
                        <add input="{QUERY_STRING}" pattern="(\&lt;|%3C).*script.*(\>|%3E)" />
                        <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" />
                        <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" />
                    <action type="Redirect" url="index.php" appendQueryString="false" redirectType="SeeOther" />
                <rule name="Joomla Search Rule" stopProcessing="true">
                    <match url="(.*)" ignoreCase="true" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{URL}" pattern="^/search.php" ignoreCase="true" />
                    <action type="Rewrite" url="/index.php?option=com_content&amp;view=article&amp;id=4" />
                <rule name="Joomla Main Rewrite Rule" stopProcessing="true">
                    <match url="(.*)" ignoreCase="true" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{URL}" pattern="(/[^.]*|\.(php|html?|feed|pdf|raw))$" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    <action type="Rewrite" url="index.php/" />
                <add extension=".php" policy="DisableCache" kernelCachePolicy="DisableCache" />

Redirect domain without www to www with web.config

It is been long time user keep on asking how to redirect the domain name with www only from their website.

To get this fixed from IIS web.config file, you may copy the following script to your web.config file to redirect them from without www to www.

<rule name="www redirect" enabled="true" stopProcessing="true">
    <match url=".*" />
        <add input="{HTTP_HOST}" pattern="^[^\.]+\.[^\.]+$" />
        <add input="{HTTPS}" pattern="off" />
    <action type="Redirect" url="http://www.{HTTP_HOST}/{R:0}" />
<rule name="www redirect https" enabled="true" stopProcessing="true">
    <match url=".*" />
        <add input="{HTTP_HOST}" pattern="^[^\.]+\.[^\.]+$" />
        <add input="{HTTPS}" pattern="on" />
    <action type="Redirect" url="https://www.{HTTP_HOST}/{R:0}" />

With the above code, it will redirect you without www to www even you have https configured.

Troubleshoot IIS7 Failed Request with Tracing

To enable Failed-Request Tracing from IIS 7, you may follow here,
1. Launch IIS7 (inetmgr in Windows Run.)
2. In the connections pane, expand the machine name, expand Sites and click on your domain entry such as mickgenie.com.
3. In the action pane, click on Failed Request Tracing.

4. In the Edit Web Site Failed Request Tracing Setting,click on the Enable checkbox  and press OK.
5. Now, go back to the site named mickgenie.com.
6. Click on the icon, Failed Request Tracing Rules.
7. In action pane, click Add.
8. In the Add Failed Request Tracing Rules wizard, select All content (*).
9. In the Define Trace Condition, define the status code such as 404.2, click Next.
10. Select the Provider, Verbosity and Areas then click Finish.

Install Web Apps Gallery to WebSitePanel/DotNetPanel

To install Microsoft Web Apps Gallery to your WebSitePanel, you may refer to this article.

1. First of all, get the Web PI(Web Platform Installer).
2. Install it to your server.
3. Open the Web PI from IIS.
4. Find the Web Deployment Tool 1.1 and 2.1 and install it.
With this Web Deployment Tool, it will install the dependencies of SQL Server 2008 R2 Management Objects and SQL Server Native Client.
5. Check if you have MySQL Connector/Net version 6 and above. If not, install it from, http://dev.mysql.com/downloads/connector/net/
6. Now, you may enable the WebSitePanel Microsoft Web App Gallery quota and you could install them from WebSitePanel.

Switch from 64 bits to 32 bits in Windows Server 2003

People always discuss if the apps could support in 64 bits server since the 64 bits server arrive to the market and you might not know that the Windows server ASP and ASP.Net could be turn from 64 bits to 32 bits.

To convert your IIS to be used 32 bits apps, open a command prompt and run the following command.
cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

So, now your 64 bits server(IIS) could run 32 bits application without any issue. And you will now need to register the 32 bits .Net Framework as 32 bits framework is not installed by default.
%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

Well done, you have done for all.

Manually Reset IIS

Sometimes, when you reset the IIS (Internet Information Services), you might not able to fully start the services but getting the error that the service could not start in the time fashion.

Firstly you may try to restart the IIS from the command prompt as below,
iisreset /stop
iisreset /start

If the above command not working, try this
iisreset /stop
net start w3csvc
net start msftpsvc
net start smtpsvc

Backup IIS 7 setting

Backup is very important especially for a productive server. We shall learned to backup everything to avoid any data missing.

For some reason, you might want to change the IIS 7 setting and do not want to mess up the setting in case you have modify any setting incorrectly.

To done this, simply run your command prompt with administrator privilege.

1. Navigate to your Windows button and right click to the command prompt then select on the “Run as administrator”.
2. Run the command line, “%windir%\system32\inetsrv\appcmd add backup mickgenie” without quotation.
3. You should be found the folder C:\Windows\System32\inetsrv\mickgenie\ and your configuration file is stored.

Delete IIS Web Sites, Applications and thier content with Web Deploy

When you install your Web App Gallery through Web Platform Installer, you might ask how to delete the application.

As Windows do not provide MSI or installer, hence you are not able to easily remove them from Window Programs Menu.

However, when you using IIS7.x and above you do come with Web Deployment Tool(Web Deploy).

There are two options depending on which node you have install to the IIS.
Web Site Deploy: Delete Web Site and Content
Application Deploy: Delete application and Content

A message will be prompt to ask you to back up everything before you delete it.

Prevent SQL injection by using IIS URL Rewrite

Nowadays, a bad or unoptimizes SQL query could easily compromised or get attacked. However you may try to reduce or prevent (Don’t say avoid, it is not possible, keke) the SQL injection through your expression rules.

If you are using IIS as your web engine, you may use some expression to reduce the SQL injection.


Continue reading Prevent SQL injection by using IIS URL Rewrite

Using ASP.Net MVC with different IIS

ASP.Net MVC is ASP.Net Modeling view controller where used to manage information and notify obeservers when that information changes.

To setting up ASP.Net MVC, you could setting it through IIS 6.0 or IIS 7.x.

  • IIS 7.x (integrated mode) – No special setting needed.
  • IIS 7.x (classic mode) – some setting needed to apply.
  • IIS 6.x or below – some setting needed to apply.

The setting needed as mentioned above actually is referring to creating the wildcard script map.

If you don’t want to use the URL mapping, you may actually ignore the setting as said, however if you want to use the mapping setting, you may refer as detail below.

IIS 7.0 with classic mode:

1.  Open IIS 7.0, select your application in the Connections window.
2. Make sure that the Features view is selected.
3. Double-click the Handler Mappings button.
4. Click the Add Wildcard Script Map link.

5. Enter the path to the aspnet_isapi.dll file (You can copy this path from the PageHandlerFactory script map)
6. Enter the name MVC.
7. Click the OK button.

IIS 6.0 or below:

1.  Right-click a website and select Properties.
2. Select the Home Directory tab.
3. Click the Configuration button.
4. Select the Mappings tab.
5. Click the Insert button.

6. Paste the path to the aspnet_isapi.dll into the Executable field (you can copy this path from the script map for .aspx files).
7. Uncheck the checkbox labeled Verify that file exists.
8. Click the OK button.