# dlang.org .htaccess file (local Apache configuration)

# Enable mod_rewrite
RewriteEngine On

# Indicate that this directory maps to the root
# directory of the domain.
RewriteBase /

# Phobos rewrites:

# Package files are now generated to std_foo.html
# instead of std_foo_package.html. This change was
# done to preserve the links to std.algorithm,
# std.range etc. after they were split into packages.
# However, we need redirects for packages in
# previous stable releases (namely, std.container).

RewriteRule ^(phobos(-prerelease)?/std_container)_package\.html $1.html [R=301,L]

Redirect 301 /appendices.html https://dlang.org/dstyle.html
Redirect 301 /COM.html http://wiki.dlang.org/COM_Programming
Redirect 301 /dll.html http://wiki.dlang.org/Win32_DLLs_in_D
Redirect 301 /how-tos.html https://wiki.dlang.org/Tutorials
Redirect 301 /htomodule.html http://wiki.dlang.org/Converting_C_.h_Files_to_D_Modules
Redirect 301 /language-reference.html https://dlang.org/spec/spec.html
Redirect 301 /memory.html http://wiki.dlang.org/Memory_Management
Redirect 301 /windows.html http://wiki.dlang.org/D_for_Win32
Redirect 301 /getstarted.html http://wiki.dlang.org/Getting_Started
Redirect 301 /tools.html http://wiki.dlang.org/Development_tools

Redirect 301 /bugstats.php /bugstats.html
Redirect 301 /bugstats.php.html /bugstats.html

RewriteRule ^changelog(.html)?$ changelog/index.html [R=301,L]

# OS detection for CLI manual
RewriteCond %{HTTP_USER_AGENT} Windows
RewriteRule ^dmd.html dmd-windows.html [R]

RewriteCond %{HTTP_USER_AGENT} Mac
RewriteRule ^dmd.html dmd-osx.html [R]

RewriteCond %{HTTP_USER_AGENT} Linux
RewriteRule ^dmd.html dmd-linux.html [R]

RewriteCond %{HTTP_USER_AGENT} FreeBSD
RewriteRule ^dmd.html dmd-freebsd.html [R]

# soft-fail to windows
RewriteRule ^dmd.html dmd-windows.html [L,R]

# legacy URLs of /spec/ pages
RewriteRule ^(spec|intro|lex|grammar|module|declaration|type|property|\
attribute|pragma|expression|statement|arrays|hash-map|struct|class|interface|\
enum|const3|function|operatoroverloading|template|template-mixin|contracts|\
version|traits|errors|unittest|garbage|float|iasm|ddoc|interfaceToC|\
cpp_interface|objc_interface|portability|entity|memory-safe-d|abi|simd|\
glossary)\
(\.html)?$ \
spec/$1.html [R=301,L]

# Foundation pages
Redirect 301 /foundation_overview.html https://dlang.org/foundation/index.html
Redirect 301 /foundation.html https://dlang.org/foundation/about.html
Redirect 301 /contributors.html https://dlang.org/foundation/contributors.html
Redirect 301 /sponsors.html https://dlang.org/foundation/sponsors.html
Redirect 301 /dlangupb-scholarship.html https://dlang.org/foundation/updscholarship.html
Redirect 301 /donate.html https://dlang.org/foundation/donate.html

# Legacy article pages
Redirect 301 /articles.html /articles/index.html
Redirect 301 /builtin.html /articles/builtin.html
Redirect 301 /code_coverage.html /articles/code_coverage.html
Redirect 301 /concepts.html /articles/constraints.html
Redirect 301 /const-faq.html /articles/const-faq.html
Redirect 301 /cppcontracts.html /articles/cppcontracts.html
Redirect 301 /cpptod.html /articles/cpptod.html
Redirect 301 /ctarguments.html /articles/ctarguments.html
Redirect 301 /ctod.html /articles/ctod.html
Redirect 301 /d-array-article.html /articles/d-array-article.html
Redirect 301 /d-floating-point.html /articles/d-floating-point.html
Redirect 301 /dll-linux.html /articles/dll-linux.html
Redirect 301 /exception-safe.html /articles/exception-safe.html
Redirect 301 /faq.html /articles/faq.html
Redirect 301 /hijack.html /articles/hijack.html
Redirect 301 /intro-to-datetime.html /articles/intro-to-datetime.html
Redirect 301 /lazy-evaluation.html /articles/lazy-evaluation.html
Redirect 301 /migrate-to-shared.html /articles/migrate-to-shared.html
Redirect 301 /mixin.html /articles/mixin.html
Redirect 301 /pretod.html /articles/pretod.html
Redirect 301 /regular-expression.html /articles/regular-expression.html
Redirect 301 /safed.html /articles/safed.html
Redirect 301 /template-comparison.html /articles/template-comparison.html
Redirect 301 /templates-revisited.html /articles/templates-revisited.html
Redirect 301 /variadic-function-templates.html /articles/variadic-function-templates.html
Redirect 301 /warnings.html /articles/warnings.html
Redirect 301 /rationale.html /articles/rationale.html

# Error pages
ErrorDocument 404 /404.html

# Permanent links to DIPs
Redirect 301 /dips/1 https://wiki.dlang.org/DIP1
Redirect 301 /dips/2 https://wiki.dlang.org/DIP2
Redirect 301 /dips/3 https://wiki.dlang.org/DIP3
Redirect 301 /dips/4 https://wiki.dlang.org/DIP4
Redirect 301 /dips/5 https://wiki.dlang.org/DIP5
Redirect 301 /dips/6 https://wiki.dlang.org/DIP6
Redirect 301 /dips/7 https://wiki.dlang.org/DIP7
Redirect 301 /dips/8 https://wiki.dlang.org/DIP8
Redirect 301 /dips/9 https://wiki.dlang.org/DIP9
Redirect 301 /dips/10 https://wiki.dlang.org/DIP10
Redirect 301 /dips/11 https://wiki.dlang.org/DIP11
Redirect 301 /dips/12 https://wiki.dlang.org/DIP12
Redirect 301 /dips/13 https://wiki.dlang.org/DIP13
Redirect 301 /dips/14 https://wiki.dlang.org/DIP14
Redirect 301 /dips/15 https://wiki.dlang.org/DIP15
Redirect 301 /dips/16 https://wiki.dlang.org/DIP16
Redirect 301 /dips/17 https://wiki.dlang.org/DIP17
Redirect 301 /dips/18 https://wiki.dlang.org/DIP18
Redirect 301 /dips/19 https://wiki.dlang.org/DIP19
Redirect 301 /dips/20 https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP20.md
Redirect 301 /dips/21 https://wiki.dlang.org/DIP21
Redirect 301 /dips/22 https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP22.md
Redirect 301 /dips/23 https://wiki.dlang.org/DIP23
Redirect 301 /dips/24 https://wiki.dlang.org/DIP24
Redirect 301 /dips/25 https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP25.md
Redirect 301 /dips/26 https://wiki.dlang.org/DIP26
Redirect 301 /dips/27 https://wiki.dlang.org/DIP27
Redirect 301 /dips/28 https://wiki.dlang.org/DIP28
Redirect 301 /dips/29 https://wiki.dlang.org/DIP29
Redirect 301 /dips/30 https://wiki.dlang.org/DIP30
Redirect 301 /dips/31 https://wiki.dlang.org/DIP31
Redirect 301 /dips/32 https://wiki.dlang.org/DIP32
Redirect 301 /dips/33 https://wiki.dlang.org/DIP33
Redirect 301 /dips/34 https://wiki.dlang.org/DIP34
Redirect 301 /dips/35 https://wiki.dlang.org/DIP35
Redirect 301 /dips/36 https://wiki.dlang.org/DIP36
Redirect 301 /dips/37 https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP37.md
Redirect 301 /dips/38 https://wiki.dlang.org/DIP38
Redirect 301 /dips/39 https://wiki.dlang.org/DIP39
Redirect 301 /dips/40 https://wiki.dlang.org/DIP40
Redirect 301 /dips/41 https://wiki.dlang.org/DIP41
Redirect 301 /dips/42 https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP42.md
Redirect 301 /dips/43 https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP43.md
Redirect 301 /dips/44 https://wiki.dlang.org/DIP44
Redirect 301 /dips/45 https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP45.md
Redirect 301 /dips/46 https://wiki.dlang.org/DIP46
Redirect 301 /dips/47 https://wiki.dlang.org/DIP47
Redirect 301 /dips/48 https://wiki.dlang.org/DIP48
Redirect 301 /dips/49 https://wiki.dlang.org/DIP49
Redirect 301 /dips/50 https://wiki.dlang.org/DIP50
Redirect 301 /dips/51 https://wiki.dlang.org/DIP51
Redirect 301 /dips/52 https://wiki.dlang.org/DIP52
Redirect 301 /dips/53 https://wiki.dlang.org/DIP53
Redirect 301 /dips/54 https://wiki.dlang.org/DIP54
Redirect 301 /dips/55 https://wiki.dlang.org/DIP55
Redirect 301 /dips/56 https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP56.md
Redirect 301 /dips/57 https://wiki.dlang.org/DIP57
Redirect 301 /dips/58 https://wiki.dlang.org/DIP58
Redirect 301 /dips/59 https://wiki.dlang.org/DIP59
Redirect 301 /dips/60 https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP60.md
Redirect 301 /dips/61 https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP61.md
Redirect 301 /dips/62 https://wiki.dlang.org/DIP62
Redirect 301 /dips/63 https://wiki.dlang.org/DIP63
Redirect 301 /dips/64 https://wiki.dlang.org/DIP64
Redirect 301 /dips/65 https://wiki.dlang.org/DIP65
Redirect 301 /dips/66 https://wiki.dlang.org/DIP66
Redirect 301 /dips/67 https://wiki.dlang.org/DIP67
Redirect 301 /dips/68 https://wiki.dlang.org/DIP68
Redirect 301 /dips/69 https://wiki.dlang.org/DIP69
Redirect 301 /dips/70 https://wiki.dlang.org/DIP70
Redirect 301 /dips/71 https://wiki.dlang.org/DIP71
Redirect 301 /dips/72 https://wiki.dlang.org/DIP72
Redirect 301 /dips/73 https://wiki.dlang.org/DIP73
Redirect 301 /dips/74 https://wiki.dlang.org/DIP74
Redirect 301 /dips/75 https://github.com/dlang/DIPs/blob/master/DIPs/archive/DIP75.md
Redirect 301 /dips/76 https://wiki.dlang.org/DIP76
Redirect 301 /dips/77 https://wiki.dlang.org/DIP77
Redirect 301 /dips/78 https://wiki.dlang.org/DIP78
Redirect 301 /dips/79 https://wiki.dlang.org/DIP79
Redirect 301 /dips/80 https://wiki.dlang.org/DIP80
Redirect 301 /dips/81 https://wiki.dlang.org/DIP81
Redirect 301 /dips/82 https://wiki.dlang.org/DIP82
Redirect 301 /dips/83 https://wiki.dlang.org/DIP83
Redirect 301 /dips/84 https://wiki.dlang.org/DIP84
Redirect 301 /dips/85 https://wiki.dlang.org/DIP85
Redirect 301 /dips/86 https://wiki.dlang.org/DIP86
Redirect 301 /dips/87 https://wiki.dlang.org/DIP87
Redirect 301 /dips/88 https://wiki.dlang.org/DIP88
Redirect 301 /dips/89 https://wiki.dlang.org/DIP89
Redirect 301 /dips/90 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1000.md
Redirect 301 /dips/1000 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1000.md
Redirect 301 /dips/1001 https://github.com/dlang/DIPs/tree/master/DIPs/rejected/DIP1001.md
Redirect 301 /dips/1002 https://github.com/dlang/DIPs/tree/master/DIPs/rejected/DIP1002.md
Redirect 301 /dips/1003 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1003.md
Redirect 301 /dips/1004 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1004.md
Redirect 301 /dips/1005 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1005.md
Redirect 301 /dips/1006 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1006.md
Redirect 301 /dips/1007 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1007.md
Redirect 301 /dips/1008 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1008.md
Redirect 301 /dips/1009 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1009.md
Redirect 301 /dips/1010 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1010.md
Redirect 301 /dips/1011 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1011.md
Redirect 301 /dips/1012 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1012.md
Redirect 301 /dips/1013 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1013.md
Redirect 301 /dips/1014 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1014.md
Redirect 301 /dips/1015 https://github.com/dlang/DIPs/tree/master/DIPs/rejected/DIP1015.md
Redirect 301 /dips/1016 https://github.com/dlang/DIPs/tree/master/DIPs/rejected/DIP1016.md
Redirect 301 /dips/1017 https://github.com/dlang/DIPs/tree/master/DIPs/rejected/DIP1017.md
Redirect 301 /dips/1018 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1018.md
Redirect 301 /dips/1019 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1019.md
Redirect 301 /dips/1020 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1020.md
Redirect 301 /dips/1021 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1021.md
Redirect 301 /dips/1022 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1022.md
Redirect 301 /dips/1023 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1023.md
Redirect 301 /dips/1024 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1024.md
Redirect 301 /dips/1025 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1025.md
Redirect 301 /dips/1026 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1026.md
Redirect 301 /dips/1027 https://github.com/dlang/DIPs/tree/master/DIPs/rejected/DIP1027.md
Redirect 301 /dips/1028 https://github.com/dlang/DIPs/tree/master/DIPs/rejected/DIP1028.md
Redirect 301 /dips/1029 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1029.md
Redirect 301 /dips/1030 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1030.md
Redirect 301 /dips/1031 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1031.md
Redirect 301 /dips/1032 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1032.md
Redirect 301 /dips/1033 https://github.com/dlang/DIPs/tree/master/DIPs/other/DIP1033.md
Redirect 301 /dips/1034 https://github.com/dlang/DIPs/tree/master/DIPs/accepted/DIP1034.md
Redirect 301 /dips/1035 https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1035.md
Redirect 301 /dips/1036 https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1036.md
Redirect 301 /dips/1037 https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1037.md
Redirect 301 /dips/1038 https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1038.md
Redirect 301 /dips/1039 https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1039.md
Redirect 301 /dips/1040 https://github.com/dlang/DIPs/blob/master/DIPs/DIP1040.md
Redirect 301 /dips/1041 https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1041.md
Redirect 301 /dips/1042 https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1042.md
Redirect 301 /dips/1043 https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1043.md
Redirect 301 /dips/1044 https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1044.md
Redirect 301 /dips/1045 https://github.com/dlang/DIPs/blob/master/DIPs/other/DIP1045.md
Redirect 301 /dips/1046 https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1046.md
