Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (36 sloc) 1.43 KB
# Apache/httpd .htaccess support for Onpub's SEO friendly URL feature.
#
# To enable Onpub friendly URLs, do the following:
#
# Add the following line to your onpub_conf_local.php file:
#
# $onpub_disp_friendly_urls = true;
#
# Make sure your main Apache configuration has the following in order to allow
# RewriteRules within .htaccess files:
#
# AllowOverride FileInfo
#
# More info: https://httpd.apache.org/docs/current/mod/core.html#allowoverride
#
# Lastly, enable SEO friendly URLs by changing the "RewriteEngine Off" line
# below to:
#
# RewriteEngine On
RewriteEngine Off
# If request matches a file, symlink or a directory, don't do any re-writing
# of the URL and allow Apache to serve the response directly.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# Now check the request for Onpub-style friendly URLs...
# Matches a URL like: http://localhost/onpub/article-linking-s1-a5
# And rewrites to: http://localhost/onpub/index.php?s=1&a=5
RewriteRule [\w-]*(-s(\d+)){1}(-a(\d+)){1}$ index.php?s=$2&a=$4 [L]
# Matches a URL like: http://localhost/onpub/demo-pages-s1
# And rewrites to: http://localhost/onpub/index.php?s=1
RewriteRule [\w-]*(-s(\d+)){1}$ index.php?s=$2 [L]
# Matches a URL like: http://localhost/onpub/article-linking-a5
# And rewrites to: http://localhost/onpub/index.php?a=5
RewriteRule [\w-]*(-a(\d+)){1}$ index.php?a=$2 [L]