gecko-dev/webtools/addons/public/htaccess.dist

92 строки
3.5 KiB
Plaintext

# a) Install me in public/htdocs/.htaccess, or
# b) Create a <Directory> entry in your Apache conf
# You MUST define YOURPATH/inc as an include_path!
php_value include_path /YOURPATH/v2/public/inc:.:/usr/share/pear:/YOURPATH/v2/shared/lib
# Init script to set up required libraries.
php_value auto_prepend_file init.php
# Finish script that calls $tpl->display for global Smarty object.
php_value auto_append_file finish.php
# Rewrite engine must be used to simplify URLs so they are human readable.
RewriteEngine On
RewriteBase /YOURPATH/public/htdocs
# Rewrites to be compatible with older versions of addons.
RewriteRule ^update/VersionCheck.php(.*)$ update.php$1
RewriteRule ^rss/index.php(.*)$ rss.php$1
# Compatibility for v1 extension and theme links.
# Old example URLs:
# /extensions/moreinfo.php?application=thunderbird&id=123
# /extensions/moreinfo.php?id=123
# /themes/moreinfo.php?id=321&application=seamonkey
# /themes/moreinfo.php?id=321
# New:
# /thunderbird/123/
# /firefox/123/
# /seamonkey/321/
# /firefox/321/
RewriteCond %{QUERY_STRING} application=(\w+)&.*id=([0-9]+)
RewriteRule ^(extensions|themes)/moreinfo.php$ %1/%2/? [R=301,L]
RewriteCond %{QUERY_STRING} id=([0-9]+)&.*application=(\w+)
RewriteRule ^(extensions|themes)/moreinfo.php$ %2/%1/? [R=301,L]
RewriteCond %{QUERY_STRING} id=([0-9]+)
RewriteRule ^(extensions|themes)/moreinfo.php$ firefox/%1/? [R=301,L]
# Compatibility for v1 of extensions. The hardcoded URL's in the old
# browsers need this to get to the right pages: (the strings are the GUIDs)
# Old example URL:
# /extensions/?application={3550f703-e582-4d05-9a08-453d09bdfdc6}
# New:
# /extensions.php?app={3550f703-e582-4d05-9a08-453d09bdfdc6}
RewriteCond %{QUERY_STRING} ^application=(.*)$
RewriteRule ^extensions/$ extensions.php?app=%1 [R=301,L]
# Compatibility for v1 of extensions. The hardcoded URL's in the old
# browsers need this to get to the right pages: (the strings are the GUIDs)
# Old example URL:
# /themes/?application={3550f703-e582-4d05-9a08-453d09bdfdc6}
# New:
# /themes.php?app={3550f703-e582-4d05-9a08-453d09bdfdc6}
RewriteCond %{QUERY_STRING} ^application=(.*)$
RewriteRule ^themes/$ themes.php?app=%1 [R=301,L]
# Send rss/* to rss.php.
# Example:
# /rss/firefox/extensions/popular/ -> rss.php?app=firefox&type=extensions&list=popular
RewriteRule ^rss/(\w+)/(\w+)/(\w+)[/]{0,1}$ rss.php?app=$1&type=$2&list=$3
# Rewrite to addon.php if all we have is a numerical id after appname.
# Example:
# /firefox/220/ -> addon.php?app=firefox&id=220
RewriteRule ^(\w+)/(\d+)[/]{0,1}$ addon.php?app=$1&id=$2
# Rewrite to an addon-specific page, passing app and id.
# Example:
# /firefox/220/previews/ -> previews.php?app=firefox&id=220
RewriteRule ^(\w+)/(\d+)/(\w+)[/]{0,1}$ $3.php?app=$1&id=$2
# Rewrite to addon.php if there is a name given plus overview (special case for addon.php).
# Example:
# /firefox/flashgot/overview/ -> addon.php?app=firefox&name=flashgot
RewriteRule ^(\w+)/(\w+)/overview[/]{0,1}$ addon.php?app=$1&name=$2
# Rewrite to addon-specific page, passing app and addon name.
# Example:
# /firefox/flashgot/previews/ -> previews.php?app=firefox&name=flashgot
RewriteRule ^(\w+)/(\w+)/(\w+)[/]{0,1}$ $3.php?app=$1&name=$2
# Rewrite top-level pages.
# Examples:
# /firefox/extensions/ -> extensions.php?app=firefox
# /firefox/themes/ -> themes.php?app=firefox
RewriteRule ^(\w+)/([\w-]+)[/]{0,1}$ $2.php?app=$1
# Rewrite for main page & app.
# Example:
# /firefox/ -> /?app=firefox
RewriteRule ^(\w+)[/]{0,1}$ index.php?app=$1