-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.htaccess
46 lines (36 loc) · 1.43 KB
/
.htaccess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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]