URL Rewrite
Contents
- 1 Overview
- 2 Platform Compatibility
- 3 Apache (Linux)
- 3.1 Directives - RewriteEngine
- 3.2 Directives - Rewrite Options
- 3.3 Directives - RewriteLog
- 3.4 Directives - RewriteLogLevel
- 3.5 Directives - RewriteLock
- 3.6 Directives - RewriteMap
- 3.7 Directives - RewriteBase
- 3.8 Directives - RewriteCond
- 3.9 Directives - RewriteRule
- 3.10 Flags - RewriteRules
- 3.11 Flags - RewriteCond
- 3.12 Variables - HTTP Headers
- 3.13 Variables - Request
- 3.14 Variables - Server Internals
- 3.15 Variables - Special
- 3.16 Variables - Time
- 3.17 <IfModule>
- 3.18 Common Issues - Filename
- 3.19 Common Issues - AllowOverride
- 3.20 Common Issues - Syntax
- 3.21 Common Issues - Special Characters
- 3.22 Common Issues - Nesting
- 3.23 Additional Resources
- 4 IIS (Windows)
- 5 ISAPIRewrite (Windows)
- 6 Redirect Codes
- 7 Regular Expressions
- 8 Common Rewrite Rules
- 8.1 Redirect to www
- 8.2 Redirect to non-www
- 8.3 Redirect Single Page
- 8.4 Redirect Entire Site
- 8.5 Redirect Entire Site with Query String
- 8.6 Redirect Entire Site to Sub-Folder
- 8.7 Redirect Sub-Folder to Different Site
- 8.8 Redirect to Different File Extension
- 8.9 Redirect to New Domain
- 8.10 Redirect Unsecure (HTTP) to Secure (HTTPS)
- 8.11 Redirect Mobile Users
- 8.12 Block IP Addresses
- 8.13 Block All Except IP Addresses
- 8.14 Block Bad Bots
- 8.15 Prevent Directory Listing
- 8.16 Custom Error Pages
- 8.17 Follow Symbolic Links
- 8.18 Redirect to Maintenance Page
- 8.19 Prevent Image Hotlinking
- 8.20 Compress Common Filetypes
- 9 Application-Specific Rewrite Rules
Overview
Platform Compatibility
Apache (Linux)
Directives - RewriteEngine
Directives - Rewrite Options
Directives - RewriteLog
Directives - RewriteLogLevel
Directives - RewriteLock
Directives - RewriteMap
Directives - RewriteBase
Directives - RewriteCond
Directives - RewriteRule
Flags - RewriteRules
Flags - RewriteCond
Variables - HTTP Headers
Variables - Request
Variables - Server Internals
Variables - Special
Variables - Time
<IfModule>
Common Issues - Filename
Common Issues - AllowOverride
Common Issues - Syntax
Common Issues - Special Characters
Common Issues - Nesting
Additional Resources
IIS (Windows)
Inbound Rules
Outbound Rules
Inheritance
Rewrite Conditions
Server Variables
String Functions
Rewrite Maps
Externalization of Rewrite Rules
Additional Resources
- URL Rewrite Community Forum
ISAPIRewrite (Windows)
Unsupported Features
Common Issues - Leading Slashes
Common Issues - Windows Filename Requirements
Additional Resources
- ISAPI_Rewrite 3
- ISAPI_Rewrite 3 - Documentation
Redirect Codes
301 - Moved Permanently
Built to be search engine friendly, the 301 redirect is best used for redirects which will not change. Robots will crawl and index these redirects.
There are no limit to how many redirects you can perform from "Site A" to "Site B". However, there is a limit to how many redirects you can chain together. (Example: Site A -> Site B -> Site C -> Site D -> Site E) Google suggest that you use no more than 3, as each redirect can cause a certain amount of latency.
"If you are getting up to the four or five hops, then that's starting to get a little bit dangerous, in the sense that Google might decide not to follow all of those redirects."
-Change page URLs with 301 redirects, video recording, Google Webmasters
302 - Found
The 302 redirect is an older standard than most. Today it is mainly used to redirect legacy browsers that do not support HTTP/1.1 (RFC 2616) status codes. (Such as 303 and 307)
303 - See Other
The purpose of the 303 status code, as defined by Semantic Web theory, is one way of responding to a request for a URI that identifies a real-world object.
An example of this would be if the URI, http://www.example.com/person/Brian, identifies a person, Brian, then it would not be appropriate for the server to return a "200" status code (OK) to the GET request, as the server cannot deliver the person "Brian". A 303 would redirect this request to a separate URI that has a description for the person "Brian".
304 - Not Modified
The status code 304 denotes that the requested resource has not changed since the version specified by the request headers. This is most commonly seen when the browser is serving cached objects for a website.
307 - Temporary Redirect
The 307 redirect is used when the request should be repeated with a different URI; however, future requests should still use the originating URI. In addition to this, the request method can not be changed when reissuing the original request. The the original request starts as a POST method, then the repeated request must also be a POST method.
308 - Permanent Redirect
The 308 status code is very similar to 302 and 301 redirects. There is a slight change to the rules however. Status code 308 does not allow for the HTTP method to change. All redirects must match the originating method.
Regular Expressions
Anchors
^
- Matches the beginning of a string.
Example: ^a
matches a string that starts with "a"
$
- Matches the end of a string.
Example: a$
matches a string that ends with "a"
Character Classes
[ ]
- Matches one of the characters int the expression.
Example: d[uoi]g
matches "dig", "dug", or "dog".
Character Classes - POSIX
[:alnum:]
- Matches any Alphanumeric character.
[:alpha:]
- Matches any Alphabetic character.
[:ascii:]
- Matches any ASCII character.
[:blank:]
- Matches "Space" and "tab".
[:cntrl:]
- Matches any Control character.
[:digit:]
- Matches any Digit.
[:graph:]
- Matches any visible character. (Everything except control characters, spaces, ect.)
[:lower:]
- Matches a lowercase letter.
[:print:]
- Matches visible characters and spaces. (Everything except control characters)
[:punct:]
- Matches punctuation and symbols.
[:space:]
- Matches any whitespace character. (Including line breaks)
[:upper:]
- Matches an uppercase letter.
[:word:]
- Matches word characters. (Letters, numbers, and underscores)
[:xdigit:]
- Matches any hexadecimal digit.
Assertions
Quantifiers
?
- Match 0 or more times.
Eample: colou?r
will match color and colour.
+
- Match at least 1 or more times.
Eample: a+
matches "a", "aa", "aaa" and so on.
*
- Match 0 to infinite number of times.
Eample: a+
matches "a", "aa", "aaa", and so on. It will also match an empty string.
{}
- Match a minimum to a maximum number of times.
Eample: b{1, 3}
- Will match "b", "bb", or "bbb".
Escape Sequences
\
- This is used for escaping characters that are used by the rewrite system.
Eample: \$
would return a literal "$" as apposed to temping to use it as part of the expression rule set.
Common Meta Characters
\b
- Matches letter not preceded or followed by another letter.
Example: \bd
matches the 'd' in "dog".
\B
- Matches a letter preceded by or followed by another letter.
Example: \Bpp
matches the 'pp' in "apple".
\cX
- "X" is a character ranging from A to Z. It matches a control character.
Example: \cV
matches control-V in a string.
\d
- Matches a digit character.
\D
- Matches a non-digit.
\f
- Matches a form feed.
\n
- Matches a line feed.
\r
- Matches a carriage return.
\s
- Matches a single whitespace character.
\S
- Matches a single character other than whitespace.
\t
- Matches a tab.
\v
- Matches a vertical tab.
\w
- Matches any alphanumeric character. (Including underscore)
\W
- Matches any non-alphanumeric character. (Including underscore)
\n
- Where "n" is a positive integer, a back reference to the last sub-string matching the "n" parenthetical in the regular expression.
\0
- Matches a NULL character. Do not follow this with another digit,
\xhh
- Matches the character with the code hh (two hexadecimal digits)
\uhhhh
- Matches the character with the code hhhh (four hexadecimal digits).
Special Characters
!
- This will negate the expression that it is placed in front of, making the condition pass only if it does not match the expression.
|
- Allows for a OR method in expressions.
Eample: (ab|ba)
would match if either "ab" or "ba" is found.
Groups and Ranges
[a-z]
- Matches any lowercase alphabetical character between the range of "a" and "z".
Eample: [a-c]
would match "a", "b", or "c".
[A-Z]
- Matches any uppercase alphabetical character between the range of "A" and "Z".
Eample: [A-C]
would match "A", "B", or "C".
[0-9]
- Matches any uppercase numeric character between the range of "0" and "9".
Eample: [3-5]
would match "3", "4", or "5".
(abc)
- Matches any uppercase numeric character between the range of "0" and "9".
Eample: [3-5]
would match "3", "4", or "5".
Pattern Modifiers
String Replacement
Testing Tools
Below is a brief list of online tools to create and test regular expressions.
- Regular Expressions 101
- RegExr
- RegexPal
- Rubular
Additional Resources
Below is a list of useful online resource to help you learn and familiarize yourself with regular expressions.
- Regular Expression (Wikipedia)
- Regular Expressions
- Regular Expressions (Mozilla)
- JavaScrip RegExp Reference
Common Rewrite Rules
Redirect to www
Linux (Apache)
# Add WWW Prefix <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC] </IfModule>
Windows (IIS)
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Redirect to www" stopProcessing="true"> <match url="^(.*)$" ignoreCase="true" /> <action type="Rewrite" url="/http://www.example.com/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
Redirect to non-www
Linux (Apache)
# Remove WWW Prefix <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.example\.com [NC] RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] </IfModule>
Windows (IIS)
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Redirect to non-www" stopProcessing="true"> <match url="^(.*)$" /> <action type="Rewrite" url="/http://example.com/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
Redirect Single Page
# Redirect page Redirect 301 /old.html /new.html
Redirect Entire Site
# Redirect entire domain Redirect 301 / http://www.example.com
Redirect Entire Site with Query String
Redirect Entire Site to Sub-Folder
Redirect Sub-Folder to Different Site
Redirect to Different File Extension
# Redirect to new file extension RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php
Redirect to New Domain
# Redirect to new domain <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} !^(www\.)?newdomain\.com$ [NC] RewriteRule .* http://newdomain.com%{REQUEST_URI} [R=301,L] RewriteCond %{HTTPS} on RewriteCond %{HTTP_HOST} !^(www\.)?newdomain\.com$ [NC] RewriteRule .* https://newdomain.com%{REQUEST_URI} [R=301,L] </IfModule>
Redirect Unsecure (HTTP) to Secure (HTTPS)
# Redirect to HTTPS <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] </IfModule>
Redirect Mobile Users
# Redirect mobile devices <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC] RewriteCond %{REQUEST_URI} ^/$ RewriteRule ^ http://m.example.com%{REQUEST_URI} [R,L] </IfModule>
Block IP Addresses
# Block IP addresses Order Deny,Allow Deny from 1.2.3.4
Block All Except IP Addresses
# Block all except IP addresses Order Deny,Allow Deny from all Allow from 1.2.3.4
Block Bad Bots
# Block bad bots <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^Bot [OR] RewriteCond %{HTTP_USER_AGENT} ^AnotherBotName RewriteRule ^.* - [F,L] </IfModule>
Prevent Directory Listing
# Prevent directory listing Options All -Indexes
Custom Error Pages
# Custom error pages ErrorDocument 400 /error400.html ErrorDocument 401 /error401.html ErrorDocument 403 /error403.html ErrorDocument 404 /error403.html ErrorDocument 500 /error500.html
Follow Symbolic Links
# Follow symbolic links Options +FollowSymLinks
Redirect to Maintenance Page
# Redirect to maintenance page <IfModule mod_rewrite.c> RewriteCond %{REMOTE_ADDR} !^64\.207\.234\.198$ RewriteCond %{REQUEST_URI} !^/maintenance\.html$ [NC] RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|png|gif|svg|swf|css|ico|js)$ [NC] RewriteRule .* /maintenance.html [R=302,L] </IfModule>
Prevent Image Hotlinking
# Prevent hotlinking <IfModule mod_rewrite.c> RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} ^https?://([^/]+)/ [NC] RewriteCond %1#%{HTTP_HOST} !^(.+)#\1$ RewriteRule \.(jpg|jpeg|png|gif|swf|svg)$ - [NC,F,L] </IfModule>
Compress Common Filetypes
# Compress common filetypes AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript
Application-Specific Rewrite Rules
CakePHP
CodeIgniter
# CodeIgniter permalinks <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>
concrete5
# Concrete5 permalinks <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>
DotNetNuke
Windows (web.config)
<configuration> <!-- register local configuration handlers --> <configSections> <sectionGroup name="dotnetnuke"> <!-- the requirePermission attribute will cause a syntax warning - please ignore - it is required for Medium Trust support--> <section name="data" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="logging" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="scheduling" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="htmlEditor" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="navigationControl" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="searchIndex" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="searchDataStore" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="friendlyUrl" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="caching" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="authentication" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="members" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="roles" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="profiles" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="permissions" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke"/> <section name="moduleCaching" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" /> <section name="outputCaching" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" /> <section name="folder" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" /> <section name="clientcapability" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" /> <section name="sitemap" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" /> </sectionGroup> <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor"> <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor" requirePermission="false" /> </sectionGroup> </configSections> <connectionStrings> <!-- Connection String for SQL Server 2008/2012 Express --> <add name="SiteSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;" providerName="System.Data.SqlClient"/> <!-- Connection String for SQL Server 2008/2012 <add name="SiteSqlServer" connectionString="Server=(local);Database=DotNetNuke;uid=;pwd=;" providerName="System.Data.SqlClient" /> --> </connectionStrings> <appSettings> <!-- Connection String for SQL Server 2008/2012 Express - kept for backwards compatability - legacy modules --> <add key="SiteSqlServer" value="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Database.mdf;"/> <!-- Connection String for SQL Server 2008/2012 - kept for backwards compatability - legacy modules <add key="SiteSqlServer" value="Server=(local);Database=DotNetNuke;uid=;pwd=;"/> --> <add key="InstallTemplate" value="DotNetNuke.install.config"/> <add key="AutoUpgrade" value="true"/> <add key="UseInstallWizard" value="true"/> <add key="InstallMemberRole" value="true"/> <add key="ShowMissingKeys" value="false"/> <add key="EnableCachePersistence" value="false"/> <add key="HostHeader" value=""/> <!-- Host Header to remove from URL so "www.mydomain.com/johndoe/Default.aspx" is treated as "www.mydomain.com/Default.aspx" --> <add key="RemoveAngleBrackets" value="false"/> <!--optionally strip angle brackets on public login and registration screens--> <add key="PersistentCookieTimeout" value="0"/> <!--use as persistent cookie expiration. Value is in minutes, and only active if a non-zero figure--> <!-- set UsePortNumber to true to preserve the port number if you're using a port number other than 80 (the standard) <add key="UsePortNumber" value="true" /> --> <!-- Services Framework Tracing is primarily useful for developing and debugging --> <add key="EnableServicesFrameworkTracing" value="false" /> <add key="UpdateServiceUrl" value="http://update.dotnetnuke.com" /> <add key="Telerik.Web.UI.ScriptFolders" value="~/Portals;" /> <add key="Telerik.Web.SkinsAssembly" value="Telerik.Web.UI.Skins, Version=2013.2.717.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4" /> <add key="PreserveLoginUrl" value="true" /> <add key="loginUrl" value="~/Login.aspx" /> </appSettings> <system.web.webPages.razor> <pages pageBaseType="DotNetNuke.Web.Razor.DotNetNukeWebPage"> <namespaces> <add namespace="WebMatrix.Data" /> <add namespace="Microsoft.Web.Helpers" /> </namespaces> </pages> </system.web.webPages.razor> <!-- The system.webServer section is required for IIS7 compatability It is ignored by IIS6--> <system.webServer> <staticContent> <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" /> </staticContent> <modules> <add name="RequestFilter" type="DotNetNuke.HttpModules.RequestFilter.RequestFilterModule, DotNetNuke.HttpModules" preCondition="managedHandler"/> <add name="UrlRewrite" type="DotNetNuke.HttpModules.UrlRewriteModule, DotNetNuke.HttpModules" preCondition="managedHandler"/> <add name="MobileRedirect" type="DotNetNuke.HttpModules.MobileRedirectModule, DotNetNuke.HttpModules" preCondition="managedHandler"/> <add name="Exception" type="DotNetNuke.HttpModules.Exceptions.ExceptionModule, DotNetNuke.HttpModules" preCondition="managedHandler"/> <add name="UsersOnline" type="DotNetNuke.HttpModules.UsersOnline.UsersOnlineModule, DotNetNuke.HttpModules" preCondition="managedHandler"/> <add name="DNNMembership" type="DotNetNuke.HttpModules.Membership.MembershipModule, DotNetNuke.HttpModules" preCondition="managedHandler"/> <add name="Personalization" type="DotNetNuke.HttpModules.Personalization.PersonalizationModule, DotNetNuke.HttpModules" preCondition="managedHandler"/> <add name="Analytics" type="DotNetNuke.HttpModules.Analytics.AnalyticsModule, DotNetNuke.HttpModules" preCondition="managedHandler"/> <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI" preCondition="managedHandler"/> <add name="Services" type="DotNetNuke.HttpModules.Services.ServicesModule, DotNetNuke.HttpModules" /> <remove name="UrlRoutingModule-4.0" /> <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" /> </modules> <handlers> <remove name="WebServiceHandlerFactory-Integrated"/> <add name="LogoffHandler*" path="Logoff.aspx" verb="*" type="DotNetNuke.Services.Authentication.LogOffHandler, DotNetNuke" preCondition="integratedMode"/> <add name="RSSHandler" path="RSS.aspx" verb="*" type="DotNetNuke.Services.Syndication.RssHandler, DotNetNuke" preCondition="integratedMode"/> <add name="LinkClickHandler" path="LinkClick.aspx" verb="*" type="DotNetNuke.Services.FileSystem.FileServerHandler, DotNetNuke" preCondition="integratedMode"/> <add name="CaptchaHandler" path="*.captcha.aspx" verb="*" type="DotNetNuke.UI.WebControls.CaptchaHandler, DotNetNuke" preCondition="integratedMode"/> <add name="Telerik.Web.UI.WebResource" verb="*" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" preCondition="integratedMode" /> <add name="Telerik.Web.UI.ChartHttpHandler" path="ChartImage.axd" verb="*" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode" /> <add name="UserProfilePageHandler" path="User.aspx" verb="*" type="DotNetNuke.Services.UserProfile.UserProfilePageHandler, DotNetNuke" preCondition="integratedMode"/> <add name="RadProgressHandler" verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.Upload.RadUploadProgressHandler, Telerik.Web.UI" preCondition="integratedMode"/> <add name="UserProfilePicHandler" path="ProfilePic.ashx" verb="*" type="DotNetNuke.Services.UserProfile.UserProfilePicHandler, DotNetNuke" preCondition="integratedMode" /> <remove name="ExtensionlessUrl-Integrated-4.0" /> <add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> <add name="SitemapHandler" path="Sitemap.aspx" verb="*" type="DotNetNuke.Services.Sitemap.SitemapHandler, DotNetNuke" preCondition="integratedMode" /> </handlers> <validation validateIntegratedModeConfiguration="false"/> <httpProtocol> <customHeaders> <remove name="X-Powered-By" /> </customHeaders> </httpProtocol> </system.webServer> <system.web> <machineKey validationKey="F9D1A2D3E1D3E2F7B3D9F90FF3965ABDAC304902" decryptionKey="F9D1A2D3E1D3E2F7B3D9F90FF3965ABDAC304902F8D923AC" decryption="3DES" validation="SHA1"/> <!-- set code access security trust level - this is generally set in the machine.config <trust level="Medium" originUrl=".*" /> --> <!-- set debugmode to false for running application --> <compilation debug="false" strict="false" targetFramework="4.0"> <buildProviders> <remove extension=".resx" /> <remove extension=".resources" /> </buildProviders> <assemblies> <add assembly="Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> </assemblies> <expressionBuilders > <add expressionPrefix="dnnLoc" type="DotNetNuke.Services.Localization.LocalizationExpressionBuilder, DotNetNuke"/> </expressionBuilders> </compilation> <!-- permits errors to be displayed for remote clients --> <customErrors mode="RemoteOnly" /> <!-- Forms or Windows authentication --> <authentication mode="Forms"> <forms name=".DOTNETNUKE" protection="All" timeout="60" cookieless="UseCookies"/> </authentication> <!-- <identity impersonate="true"/> <authentication mode="Windows"> </authentication> --> <!-- allow large file uploads --> <httpRuntime shutdownTimeout="120" executionTimeout="900" useFullyQualifiedRedirectUrl="true" maxRequestLength="12288" requestLengthDiskThreshold="12288" requestPathInvalidCharacters="<,>,*,%,:,\,?" enableVersionHeader="false" requestValidationMode="2.0"/> <httpCookies httpOnlyCookies="true" requireSSL="false" domain=""/> <!-- GLOBALIZATION This section sets the globalization settings of the application. Utf-8 is not supported on Netscape 4.x If you need netscape compatiblity leave iso-8859-1. UTF-8 is recommended for complex languages --> <globalization culture="en-US" uiCulture="en" requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8"/> <!--<globalization culture="en-US" uiCulture="en" fileEncoding="iso-8859-1" requestEncoding="iso-8859-1" responseEncoding="iso-8859-1"/>--> <!-- page level options --> <pages validateRequest="false" enableViewStateMac="true" enableEventValidation="true" viewStateEncryptionMode="Always"> <namespaces> <add namespace="System.ComponentModel"/> <add namespace="System.Data"/> <add namespace="System.Data.SqlClient"/> <add namespace="System.Drawing"/> <add namespace="Microsoft.VisualBasic"/> <add namespace="System.Globalization"/> <add namespace="DotNetNuke.Services.Localization"/> <add namespace="DotNetNuke.Entities.Users"/> <add namespace="DotNetNuke"/> <add namespace="DotNetNuke.Common"/> <add namespace="DotNetNuke.Data"/> <add namespace="DotNetNuke.Framework"/> <add namespace="DotNetNuke.Modules"/> <add namespace="DotNetNuke.Security"/> <add namespace="DotNetNuke.Services"/> <add namespace="DotNetNuke.UI"/> <add namespace="DotNetNuke.Entities.Portals"/> <add namespace="DotNetNuke.Common.Utilities"/> <add namespace="DotNetNuke.Services.Exceptions"/> <add namespace="DotNetNuke.Entities.Tabs"/> </namespaces> <controls> </controls> </pages> <!-- ASP.NET 2 Membership/Profile/Role and AnonymousAuthentication Providers --> <!-- anonymousIdentification configuration: enabled="[true|false]" Feature is enabled? cookieName=".ASPXANONYMOUS" Cookie Name cookieTimeout="100000" Cookie Timeout in minutes cookiePath="/" Cookie Path cookieRequireSSL="[true|false]" Set Secure bit in Cookie cookieSlidingExpiration="[true|false]" Reissue expiring cookies? cookieProtection="[None|Validation|Encryption|All]" How to protect cookies from being read/tampered domain="[domain]" Enables output of the "domain" cookie attribute set to the specified value --> <anonymousIdentification enabled="true" cookieName=".ASPXANONYMOUS" cookieTimeout="100000" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="None" domain=""/> <membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="15"> <providers> <clear/> <!-- Configuration for AspNetSqlMembershipProvider: connectionStringName="string" Name corresponding to the entry in <connectionStrings> section where the connection string for the provider is specified maxInvalidPasswordAttempts="int" The number of failed password attempts, or failed password answer attempts that are allowed before locking out a user?s account passwordAttemptWindow="int" The time window, in minutes, during which failed password attempts and failed password answer attempts are tracked enablePasswordRetrieval="[true|false]" Should the provider support password retrievals enablePasswordReset="[true|false]" Should the provider support password resets requiresQuestionAndAnswer="[true|false]" Should the provider require Q & A minRequiredPasswordLength="int" The minimum password length minRequiredNonalphanumericCharacters="int" The minimum number of non-alphanumeric characters applicationName="string" Optional string to identity the application: defaults to Application Metabase path requiresUniqueEmail="[true|false]" Should the provider require a unique email to be specified passwordFormat="[Clear|Hashed|Encrypted]" Storage format for the password: Hashed (SHA1), Clear or Encrypted (Triple-DES) description="string" Description of what the provider does --> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="SiteSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="0" requiresUniqueEmail="false" passwordFormat="Hashed" applicationName="DotNetNuke" description="Stores and retrieves membership data from the local Microsoft SQL Server database"/> </providers> </membership> </system.web> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatePath="bin;bin\HttpModules;bin\Providers;bin\Modules;bin\Support;"/> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="4.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="4.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" /> <bindingRedirect oldVersion="2008.0.0.0-2020.0.0.0" newVersion="2013.2.717.40" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> <dotnetnuke> <htmlEditor defaultProvider="DotNetNuke.RadEditorProvider"> <providers> <clear/> <add name="DotNetNuke.RadEditorProvider" type="DotNetNuke.Providers.RadEditorProvider.EditorProvider, DotNetNuke.RadEditorProvider" providerPath="~/DesktopModules/Admin/RadEditorProvider" /> </providers> </htmlEditor> <navigationControl defaultProvider="DNNMenuNavigationProvider"> <providers> <clear/> <add name="DNNDropDownNavigationProvider" type="DotNetNuke.NavigationControl.DNNDropDownNavigationProvider, DotNetNuke.DNNDropDownNavigationProvider" providerPath="~\Providers\NavigationProviders\DNNDropDownNavigationProvider\"/> <add name="ASP2MenuNavigationProvider" type="DotNetNuke.NavigationControl.ASP2MenuNavigationProvider, DotNetNuke.ASP2MenuNavigationProvider" providerPath="~\Providers\NavigationProviders\ASP2MenuNavigationProvider\"/> <add name="DNNMenuNavigationProvider" type="DotNetNuke.NavigationControl.DNNMenuNavigationProvider, DotNetNuke.DNNMenuNavigationProvider" providerPath="~\Providers\NavigationProviders\DNNMenuNavigationProvider\"/> <add name="DNNTreeNavigationProvider" type="DotNetNuke.NavigationControl.DNNTreeNavigationProvider, DotNetNuke.DNNTreeNavigationProvider" providerPath="~\Providers\NavigationProviders\DNNTreeNavigationProvider\"/> <add name="SolpartMenuNavigationProvider" type="DotNetNuke.NavigationControl.SolpartMenuNavigationProvider, DotNetNuke.SolpartMenuNavigationProvider" providerPath="~\Providers\NavigationProviders\SolpartMenuNavigationProvider\"/> </providers> </navigationControl> <searchIndex defaultProvider="ModuleIndexProvider"> <providers> <clear/> <add name="ModuleIndexProvider" type="DotNetNuke.Services.Search.ModuleIndexer, DotNetNuke" providerPath="~\Providers\SearchProviders\ModuleIndexer\"/> </providers> </searchIndex> <searchDataStore defaultProvider="SearchDataStoreProvider"> <providers> <clear/> <add name="SearchDataStoreProvider" type="DotNetNuke.Services.Search.SearchDataStore, DotNetNuke" providerPath="~\Providers\SearchProviders\SearchDataStore\"/> </providers> </searchDataStore> <data defaultProvider="SqlDataProvider"> <providers> <clear/> <add name="SqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke" connectionStringName="SiteSqlServer" upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\" objectQualifier="" databaseOwner="dbo"/> </providers> </data> <logging defaultProvider="DBLoggingProvider"> <providers> <clear/> <add name="DBLoggingProvider" type="DotNetNuke.Services.Log.EventLog.DBLoggingProvider, DotNetNuke" providerPath="~\Providers\LoggingProviders\DBLoggingProvider\"/> </providers> </logging> <scheduling defaultProvider="DNNScheduler"> <providers> <clear/> <add name="DNNScheduler" type="DotNetNuke.Services.Scheduling.DNNScheduler, DotNetNuke" providerPath="~\Providers\SchedulingProviders\DNNScheduler\" debug="false" maxThreads="1" delayAtAppStart="60" /> </providers> </scheduling> <friendlyUrl defaultProvider="DNNFriendlyUrl"> <providers> <clear/> <add name="DNNFriendlyUrl" type="DotNetNuke.Services.Url.FriendlyUrl.DNNFriendlyUrlProvider, DotNetNuke.HttpModules" includePageName="true" regexMatch="[^a-zA-Z0-9 _-]" urlFormat="advanced"/> </providers> </friendlyUrl> <caching defaultProvider="FileBasedCachingProvider"> <providers> <clear/> <add name="FileBasedCachingProvider" type="DotNetNuke.Services.Cache.FBCachingProvider, DotNetNuke" providerPath="~\Providers\CachingProviders\FileBasedCachingProvider\"/> </providers> </caching> <authentication defaultProvider="ADSIAuthenticationProvider"> <providers> <clear/> <add name="ADSIAuthenticationProvider" type="DotNetNuke.Authentication.ActiveDirectory.ADSI.ADSIProvider, DotNetNuke.Authentication.ActiveDirectory" providerPath="~\Providers\AuthenticationProviders\ADSIProvider\"/> </providers> </authentication> <members defaultProvider="AspNetMembershipProvider"> <providers> <clear/> <add name="AspNetMembershipProvider" type="DotNetNuke.Security.Membership.AspNetMembershipProvider, DotNetNuke" providerPath="~\Providers\MembershipProviders\AspNetMembershipProvider\"/> </providers> </members> <roles defaultProvider="DNNRoleProvider"> <providers> <clear/> <add name="DNNRoleProvider" type="DotNetNuke.Security.Roles.DNNRoleProvider, DotNetNuke" providerPath="~\Providers\MembershipProviders\DNNMembershipProvider\"/> </providers> </roles> <profiles defaultProvider="DNNProfileProvider"> <providers> <clear/> <add name="DNNProfileProvider" type="DotNetNuke.Security.Profile.DNNProfileProvider, DotNetNuke" providerPath="~\Providers\MembershipProviders\DNNProfileProvider\"/> </providers> </profiles> <permissions defaultProvider="CorePermissionProvider"> <providers> <clear/> <add name="CorePermissionProvider" type="DotNetNuke.Security.Permissions.CorePermissionProvider, DotNetNuke" providerPath="~\Providers\PermissionProviders\CorePermissionProvider\" /> </providers> </permissions> <moduleCaching defaultProvider="FileModuleCachingProvider"> <providers> <clear /> <add name="FileModuleCachingProvider" type="DotNetNuke.Services.ModuleCache.FileProvider, DotNetNuke" providerPath="~\Providers\ModuleCachingProviders\FileModuleCachingProvider\" /> <add name="MemoryModuleCachingProvider" type="DotNetNuke.Services.ModuleCache.MemoryProvider, DotNetNuke" providerPath="~\Providers\ModuleCachingProviders\MemoryModuleCachingProvider\" /> </providers> </moduleCaching> <outputCaching defaultProvider="FileOutputCachingProvider"> <providers> <clear /> </providers> </outputCaching> <folder defaultProvider="StandardFolderProvider"> <providers> <clear /> <add name="StandardFolderProvider" type="DotNetNuke.Services.FileSystem.StandardFolderProvider, DotNetNuke" /> <add name="SecureFolderProvider" type="DotNetNuke.Services.FileSystem.SecureFolderProvider, DotNetNuke" /> <add name="DatabaseFolderProvider" type="DotNetNuke.Services.FileSystem.DatabaseFolderProvider, DotNetNuke" /> </providers> </folder> <clientcapability defaultProvider="FiftyOneClientCapabilityProvider"> <providers> <clear /> <add name="FiftyOneClientCapabilityProvider" type="DotNetNuke.Providers.FiftyOneClientCapabilityProvider.FiftyOneClientCapabilityProvider, DotNetNuke.Providers.FiftyOneClientCapabilityProvider" providerPath="~\Providers\ClientCapabilityProviders\FiftyOneClientCapabilityProvider\" /> </providers> </clientcapability> <sitemap defaultProvider="coreSitemapProvider"> <providers> <clear /> <add name="coreSitemapProvider" type="DotNetNuke.Services.Sitemap.CoreSitemapProvider, DotNetNuke" providerPath="~\Providers\MembershipProviders\Sitemap\CoreSitemapProvider\" /> </providers> </sitemap> </dotnetnuke> </configuration>
Joomla
Linux (.htaccess)
# Joomla permalinks <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} !^/index\.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php [L] </IfModule>
Windows (web.config)
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Joomla! Rule 1" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAny"> <add input="{QUERY_STRING}" pattern="base64_encode[^(]*\([^)]*\)" ignoreCase="false" /> <add input="{QUERY_STRING}" pattern="(>|%3C)([^s]*s)+cript.*(<|%3E)" /> <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" /> <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" /> </conditions> <action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" /> </rule> <rule name="Joomla! Rule 2"> <match url="(.*)" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="^/index.php" ignoreCase="true" negate="true" /> <add input="{URL}" pattern="/component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
Magento
Linux (.htaccess)
############################################ ## uncomment these lines for CGI mode ## make sure to specify the correct cgi php binary file name ## it might be /cgi-bin/php-cgi # Action php5-cgi /cgi-bin/php5-cgi # AddHandler php5-cgi .php ############################################ ## GoDaddy specific options # Options -MultiViews ## you might also need to add this line to php.ini ## cgi.fix_pathinfo = 1 ## if it still doesn't work, rename php.ini to php5.ini ############################################ ## this line is specific for 1and1 hosting #AddType x-mapp-php5 .php #AddHandler x-mapp-php5 .php ############################################ ## default index file DirectoryIndex index.php <IfModule mod_php5.c> ############################################ ## adjust memory limit php_value memory_limit 512M php_value max_execution_time 18000 ############################################ ## disable magic quotes for php request vars php_flag magic_quotes_gpc off ############################################ ## disable automatic session start ## before autoload was initialized php_flag session.auto_start off ############################################ ## enable resulting html compression #php_flag zlib.output_compression on ########################################### # disable user agent verification to not break multiple image upload php_flag suhosin.session.cryptua off ########################################### # turn off compatibility with PHP4 when dealing with objects php_flag zend.ze1_compatibility_mode Off </IfModule> <IfModule mod_security.c> ########################################### # disable POST processing to not break multiple image upload SecFilterEngine Off SecFilterScanPOST Off </IfModule> <IfModule mod_deflate.c> ############################################ ## enable apache served files compression ## http://developer.yahoo.com/performance/rules.html#gzip # Insert filter on all content ###SetOutputFilter DEFLATE # Insert filter on selected content types only #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript # Netscape 4.x has some problems... #BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems #BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # Don't compress images #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content #Header append Vary User-Agent env=!dont-vary </IfModule> <IfModule mod_ssl.c> ############################################ ## make HTTPS env vars available for CGI mode SSLOptions StdEnvVars </IfModule> <IfModule mod_rewrite.c> ############################################ ## enable rewrites Options +FollowSymLinks RewriteEngine on ############################################ ## you can put here your magento root folder ## path relative to web root #RewriteBase /magento/ ############################################ ## workaround for HTTP authorization ## in CGI environment RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] ############################################ ## always send 404 on missing files in these folders RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ ############################################ ## never rewrite for existing files, directories and links RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l ############################################ ## rewrite everything else to index.php RewriteRule .* index.php [L] </IfModule> ############################################ ## Prevent character encoding issues from server overrides ## If you still have problems, use the second line instead AddDefaultCharset Off #AddDefaultCharset UTF-8 <IfModule mod_expires.c> ############################################ ## Add default Expires header ## http://developer.yahoo.com/performance/rules.html#expires ExpiresDefault "access plus 1 year" </IfModule> ############################################ ## By default allow all access Order allow,deny Allow from all ############################################ ## If running in cluster environment, uncomment this ## http://developer.yahoo.com/performance/rules.html#etags #FileETag none
Windows (web.config)
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Magento SEO: remove index.php from URL"> <match url="^(?!index.php)([^?#]*)(\\?([^#]*))?(#(.*))?" /> <conditions> <add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:0}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
Mura
Linux (.htaccess)
# Apache mod_rewrite Docs: http://httpd.apache.org/docs/current/rewrite/ # Intro: http://httpd.apache.org/docs/current/rewrite/intro.html # Flags: http://httpd.apache.org/docs/current/rewrite/flags.html Options All -Indexes Options +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Rewrite only nonexistent file or directory path RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # ------------------------------------------------------------------------------- # MURA REWRITE OPTIONS # # NOTE: If running on Tomcat with sites using the SiteID in the URL # a custom servlet mapping will be required for each site. # Instructions: http://docs.getmura.com/v6/installation-setup/how-to-add-a-servlet-mapping-for-your-siteid-to-tomcat/ # ------------------------------------------------------------------------------- # OPTION 1 :: WITHOUT SiteID # In /config/settings.ini.cfm, set both siteidinurls and indexfileinurls to 0 # and reload the Mura application RewriteRule ^(.*) /index.cfm/$1 [NC,QSA,PT] # OPTION 2 :: WITH SiteID # In /config/settings.ini.cfm, set indexfileinurls to 0 # and reload the Mura application #RewriteRule ^([a-zA-Z0-9_\-]{1,})/(.*) /$1/index.cfm/$2 [NC,QSA,PT] # OPTION 3 :: Advanced Configuration # To use the SiteID in the URL for SPECIFIC SITES ONLY, but not for all sites: # First, add a custom getURLStem() method to the Site's contentRenderer.cfc, # then ENABLE OPTION 1 above, adding a custom rewrite rule for each site: #RewriteRule ^YourSiteID/(.*) /YourSiteID/index.cfm/$1 [NC,QSA,PT] # 404 :: Redirect to 404.cfm with the requested URI as a query string # This assumes a custom file named 404.cfm exists in your root directory #RewriteRule (.*) 404.cfm?%{REQUEST_URI}?%{QUERY_STRING} # Forbid executable files from being downloaded RewriteRule \.exe - [F] </IfModule> # ------------------------------------------------------------------------------- # UTF-8 encoding # ------------------------------------------------------------------------------- # Use UTF-8 encoding for anything served text/plain or text/html AddDefaultCharset utf-8 # Force UTF-8 for a number of file formats AddCharset utf-8 .css .js .xml .json .rss .atom <FilesMatch ".(eot|ttf|otf|woff)"> Header set Access-Control-Allow-Origin "*" </FilesMatch>
Windows (Web.config)
<?xml version="1.0" encoding="UTF-8"?> <!-- REQUIREMENTS: - IIS 7 or greater - Removing 'index.cfm' requires IIS URL Rewrite Module 2.0 (http://www.iis.net/download/URLRewrite) --> <!-- AVAILABLE OPTIONS: Rule 1: index.cfm and siteid in URL disabled Rule 2: index.cfm in URL disabled SEO Rules: allow for separate sitemap and robots files per site --> <!-- USAGE: - Rename this document to "web.config" (without the quotation marks) or copy the <rewrite><rules> section below into your working web.config - Enable the rewrite options below by changing the enabled value to "true" - Edit /config/settings.ini.cfm as noted in the comments before each rule - Reload Mura CMS --> <configuration> <system.webServer> <rewrite> <rules> <!-- Rule 1: URLs without SiteID or index.cfm Usage: - set enabled="true" below - set Mura CMS Rule 2 to enabled="false" - set these values in /config/settings.ini.cfm: siteidinurls=0 indexfileinurls=0 - reload Mura CMS --> <rule name="Mura CMS Rule 1: siteid and index.cfm" enabled="true"> <match url="^(.*)" ignoreCase="true" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="/index.cfm/{R:1}" appendQueryString="true" /> </rule> <!-- Rule 2: URLs without index.cfm Usage: - set enabled="true" below - set Mura CMS Rule 1 to enabled="false" - set these values in /config/settings.ini.cfm: siteidinurls=1 indexfileinurls=0 - reload Mura CMS --> <rule name="Mura CMS Rule 2: index.cfm" enabled="false"> <match url="^([a-zA-Z0-9_\-]{1,})/(.*)" ignoreCase="true" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> <add input="{QUERY_STRING}" pattern="(hash)" negate="true" /> </conditions> <action type="Rewrite" url="/{R:1}/index.cfm/{R:2}" appendQueryString="true" /> </rule> <!-- SEO Rules: individual sitemap.xml and/or robots.txt for each site Recommended for use with Meld Google Sitemaps Plugin Usage: - set enabled="true" below - duplicate and rename rules for each site - replace www.domain.com and /siteID/ in each rule --> <rule name="Mura CMS SEO: Sitemap" stopProcessing="true" enabled="false"> <match url="^sitemap.xml$" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_HOST}" pattern="^www.domain.com$" ignoreCase="false" /> </conditions> <action type="Rewrite" url="/siteID/sitemap.xml" /> </rule> <rule name="Mura CMS SEO: Robots" stopProcessing="true" enabled="false"> <match url="^robots.txt$" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_HOST}" pattern="^www.domain.com$" ignoreCase="false" /> </conditions> <action type="Rewrite" url="/siteID/robots.txt" /> </rule> </rules> </rewrite> <defaultDocument> <files> <remove value="index.cfm" /> <add value="index.cfm" /> </files> </defaultDocument> <staticContent> <remove fileExtension=".woff" /> <mimeMap fileExtension=".woff" mimeType="application/octet-stream" /> </staticContent> </system.webServer> </configuration>
WordPress
To enable permalinks within WordPress:
- Login to your WordPress dashboard
- Hover over Settings on the menu
- Choose Permalinks from the menu that appears
- Choose one of the available permalink structures
- Click the Save Changes button
Linux (.htaccess)
This file is generated by WordPress automatically when Permalinks are enabled using the instructions above. It is provided here for reference.
# Wordpress permalinks <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
Windows (web.config)
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="WordPress Permalinks - Homepage" stopProcessing="true"> <match url="^index\.php$" /> <action type="None" /> </rule> <rule name="WordPress Permalinks - All Requests" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite> </system.webServer> </configuration>