Fix htaccess-parser: ignoring all comments and blank lines, add more tests files

parent 2509b22b
......@@ -22,11 +22,7 @@ class HtaccessParser:
elif line_type == 'RedirectMatch':
res_line = '{} {}'.format(line_parts[2], line_parts[3])
#print('\n')
#print('######')
#print(line)
#print(res_line)
#print('######')
return res_line
......@@ -40,12 +36,19 @@ class HtaccessReader:
abs_path = os.path.abspath(htaccess_file)
res = []
f = open(abs_path, 'r')
f = open(abs_path, 'r', encoding='UTF-8')
for line in f:
res.append('\n')
res.append('# {}'.format(line)) # for tests
res.append(self.line_parser.parse_line(line))
res.append('\n')
print('line is', line)
if len(line) > 2 and not line.startswith('#'):
res.append('\n')
res.append('# {}'.format(line)) # for tests
res.append(self.line_parser.parse_line(line))
res.append('\n')
f.close()
self.write_map(res, map_name)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
#php_value upload_max_filesize 50M
#php_value post_max_size 50M
#php5_value max_execution_time 120
RewriteRule ^wp/(.*)$ /$1 [R=301,L]
###íå ðàáîòàåò
RewriteRule ^m-o-promysle-i-svobode-voli.shtml$ /m-o-promysle-i-svobode-voli [R=301,L]
###
RewriteRule ^dictionary/08/sorokin_izuchenie_biblii_?\d*-?a?l?l?.shtml$ /zavet-bozhij [R=301,L]
RewriteRule ^dictionary/01/asketizm.shtml /asketizm-askeza [R=301,L]
Redirect 301 /zavet-bozhij.shtml /zavet-bozhij
Redirect 301 /dictionary/05/dni_tvoreniya.shtml /m-dni-tvoreniya
Redirect 301 /dictionary/13/o_nimbe-all.shtml /nimb
#
RewriteRule ^m-zavet-bozhij.shtml$ /m-zavet-bozhij [R=301,L]
RewriteRule ^dictionary/08/paramonov_zapovedi_bozhii_?\d*-?a?l?l?.shtml$ /zapovedi-bozhii-v-povsednevnoj-zhizni [R=301,L]
RewriteRule ^dictionary/12/mitra-all.shtml$ /mitra [R=301,L]
Redirect 301 /zapovedi-bozhii-v-povsednevnoj-zhizni.shtml /zapovedi-bozhii-v-povsednevnoj-zhizni
#
RewriteRule ^m-zapovedi-bozhii-v-povsednevnoj-zhizni.shtml$ /m-zapovedi-bozhii-v-povsednevnoj-zhizni [R=301,L]
RewriteRule ^dictionary/01/kolliander_uzkiy_put_\d+-all.shtml$ /uzkij-put [R=301,L]
Redirect 301 /uzkij-put.shtml /uzkij-put
#
RewriteRule ^m-uzkij-put.shtml$ /m-uzkij-put [R=301,L]
RewriteRule ^dictionary/17/o_grehovnosti_suevery_\d+-all.shtml$ /o-grexovnosti-sueverij [R=301,L]
Redirect 301 /o-grexovnosti-sueverij.shtml /o-grexovnosti-sueverij
#
RewriteRule ^m-o-grexovnosti-sueverij.shtml$ /m-o-grexovnosti-sueverij [R=301,L]
RewriteRule ^dictionary/17/strah_bozhiy_\d+-all.shtml$ /o-straxe-bozhiem [R=301,L]
Redirect 301 /o-straxe-bozhiem.shtml /o-straxe-bozhiem
#
RewriteRule ^m-o-straxe-bozhiem.shtml$ /m-o-straxe-bozhiem [R=301,L]
RewriteRule ^dictionary/17/sergiy_uchenie_o_spasenii_\d+-all.shtml$ /pravoslavnoe-uchenie-o-spasenii [R=301,L]
Redirect 301 /pravoslavnoe-uchenie-o-spasenii.shtml /pravoslavnoe-uchenie-o-spasenii
#
RewriteRule ^m-pravoslavnoe-uchenie-o-spasenii.shtml$ /m-pravoslavnoe-uchenie-o-spasenii [R=301,L]
RewriteRule ^dictionary/22/florovsky_bogoslovskie_stati_\d+-all.shtml$ /bogoslovskie_stati_o_cerkvi [R=301,L]
Redirect 301 /bogoslovskie_stati_o_cerkvi.shtml /bogoslovskie_stati_o_cerkvi
#
RewriteRule ^m-bogoslovskie_stati_o_cerkvi.shtml$ /m-bogoslovskie_stati_o_cerkvi [R=301,L]
RewriteRule ^dictionary/17/afanasev_tserkovnye_sobory_\d+-all.shtml$ /cerkovnye-sobory-i-ix-proisxozhdenie [R=301,L]
Redirect 301 /cerkovnye-sobory-i-ix-proisxozhdenie.shtml /cerkovnye-sobory-i-ix-proisxozhdenie
#
RewriteRule ^m-cerkovnye-sobory-i-ix-proisxozhdenie.shtml$ /m-cerkovnye-sobory-i-ix-proisxozhdenie [R=301,L]
RewriteRule ^dictionary/17/o_snovideniyah_\d+-all.shtml$ /o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam [R=301,L]
Redirect 301 /o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam.shtml /o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam
#
RewriteRule ^m-o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam.shtml$ /m-o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam [R=301,L]
RewriteRule ^dictionary/17/simvol_very\d+-all.shtml$ /besedy-o-simvole-very [R=301,L]
Redirect 301 /besedy-o-simvole-very.shtml /besedy-o-simvole-very
#
RewriteRule ^m-besedy-o-simvole-very.shtml$ /m-besedy-o-simvole-very [R=301,L]
RewriteRule ^dictionary/17/men_veruyu_besedy_\d+-all.shtml$ /veruyu-besedy-o-simvole-very [R=301,L]
Redirect 301 /veruyu-besedy-o-simvole-very.shtml /veruyu-besedy-o-simvole-very
# RewriteRule ^wp/(.*)$ /$1 [R=301,L]
^wp/(.*)$ /$1
# RewriteRule ^m-o-promysle-i-svobode-voli.shtml$ /m-o-promysle-i-svobode-voli [R=301,L]
^m-o-promysle-i-svobode-voli.shtml$ /m-o-promysle-i-svobode-voli
# RewriteRule ^dictionary/08/sorokin_izuchenie_biblii_?\d*-?a?l?l?.shtml$ /zavet-bozhij [R=301,L]
^dictionary/08/sorokin_izuchenie_biblii_?\d*-?a?l?l?.shtml$ /zavet-bozhij
# RewriteRule ^dictionary/01/asketizm.shtml /asketizm-askeza [R=301,L]
^dictionary/01/asketizm.shtml /asketizm-askeza
# Redirect 301 /zavet-bozhij.shtml /zavet-bozhij
/zavet-bozhij.shtml /zavet-bozhij [status=301]
# Redirect 301 /dictionary/05/dni_tvoreniya.shtml /m-dni-tvoreniya
/dictionary/05/dni_tvoreniya.shtml /m-dni-tvoreniya [status=301]
# Redirect 301 /dictionary/13/o_nimbe-all.shtml /nimb
/dictionary/13/o_nimbe-all.shtml /nimb [status=301]
# RewriteRule ^m-zavet-bozhij.shtml$ /m-zavet-bozhij [R=301,L]
^m-zavet-bozhij.shtml$ /m-zavet-bozhij
# RewriteRule ^dictionary/08/paramonov_zapovedi_bozhii_?\d*-?a?l?l?.shtml$ /zapovedi-bozhii-v-povsednevnoj-zhizni [R=301,L]
^dictionary/08/paramonov_zapovedi_bozhii_?\d*-?a?l?l?.shtml$ /zapovedi-bozhii-v-povsednevnoj-zhizni
# RewriteRule ^dictionary/12/mitra-all.shtml$ /mitra [R=301,L]
^dictionary/12/mitra-all.shtml$ /mitra
# Redirect 301 /zapovedi-bozhii-v-povsednevnoj-zhizni.shtml /zapovedi-bozhii-v-povsednevnoj-zhizni
/zapovedi-bozhii-v-povsednevnoj-zhizni.shtml /zapovedi-bozhii-v-povsednevnoj-zhizni [status=301]
# RewriteRule ^m-zapovedi-bozhii-v-povsednevnoj-zhizni.shtml$ /m-zapovedi-bozhii-v-povsednevnoj-zhizni [R=301,L]
^m-zapovedi-bozhii-v-povsednevnoj-zhizni.shtml$ /m-zapovedi-bozhii-v-povsednevnoj-zhizni
# RewriteRule ^dictionary/01/kolliander_uzkiy_put_\d+-all.shtml$ /uzkij-put [R=301,L]
^dictionary/01/kolliander_uzkiy_put_\d+-all.shtml$ /uzkij-put
# Redirect 301 /uzkij-put.shtml /uzkij-put
/uzkij-put.shtml /uzkij-put [status=301]
# RewriteRule ^m-uzkij-put.shtml$ /m-uzkij-put [R=301,L]
^m-uzkij-put.shtml$ /m-uzkij-put
# RewriteRule ^dictionary/17/o_grehovnosti_suevery_\d+-all.shtml$ /o-grexovnosti-sueverij [R=301,L]
^dictionary/17/o_grehovnosti_suevery_\d+-all.shtml$ /o-grexovnosti-sueverij
# Redirect 301 /o-grexovnosti-sueverij.shtml /o-grexovnosti-sueverij
/o-grexovnosti-sueverij.shtml /o-grexovnosti-sueverij [status=301]
# RewriteRule ^m-o-grexovnosti-sueverij.shtml$ /m-o-grexovnosti-sueverij [R=301,L]
^m-o-grexovnosti-sueverij.shtml$ /m-o-grexovnosti-sueverij
# RewriteRule ^dictionary/17/strah_bozhiy_\d+-all.shtml$ /o-straxe-bozhiem [R=301,L]
^dictionary/17/strah_bozhiy_\d+-all.shtml$ /o-straxe-bozhiem
# Redirect 301 /o-straxe-bozhiem.shtml /o-straxe-bozhiem
/o-straxe-bozhiem.shtml /o-straxe-bozhiem [status=301]
# RewriteRule ^m-o-straxe-bozhiem.shtml$ /m-o-straxe-bozhiem [R=301,L]
^m-o-straxe-bozhiem.shtml$ /m-o-straxe-bozhiem
# RewriteRule ^dictionary/17/sergiy_uchenie_o_spasenii_\d+-all.shtml$ /pravoslavnoe-uchenie-o-spasenii [R=301,L]
^dictionary/17/sergiy_uchenie_o_spasenii_\d+-all.shtml$ /pravoslavnoe-uchenie-o-spasenii
# Redirect 301 /pravoslavnoe-uchenie-o-spasenii.shtml /pravoslavnoe-uchenie-o-spasenii
/pravoslavnoe-uchenie-o-spasenii.shtml /pravoslavnoe-uchenie-o-spasenii [status=301]
# RewriteRule ^m-pravoslavnoe-uchenie-o-spasenii.shtml$ /m-pravoslavnoe-uchenie-o-spasenii [R=301,L]
^m-pravoslavnoe-uchenie-o-spasenii.shtml$ /m-pravoslavnoe-uchenie-o-spasenii
# RewriteRule ^dictionary/22/florovsky_bogoslovskie_stati_\d+-all.shtml$ /bogoslovskie_stati_o_cerkvi [R=301,L]
^dictionary/22/florovsky_bogoslovskie_stati_\d+-all.shtml$ /bogoslovskie_stati_o_cerkvi
# Redirect 301 /bogoslovskie_stati_o_cerkvi.shtml /bogoslovskie_stati_o_cerkvi
/bogoslovskie_stati_o_cerkvi.shtml /bogoslovskie_stati_o_cerkvi [status=301]
# RewriteRule ^m-bogoslovskie_stati_o_cerkvi.shtml$ /m-bogoslovskie_stati_o_cerkvi [R=301,L]
^m-bogoslovskie_stati_o_cerkvi.shtml$ /m-bogoslovskie_stati_o_cerkvi
# RewriteRule ^dictionary/17/afanasev_tserkovnye_sobory_\d+-all.shtml$ /cerkovnye-sobory-i-ix-proisxozhdenie [R=301,L]
^dictionary/17/afanasev_tserkovnye_sobory_\d+-all.shtml$ /cerkovnye-sobory-i-ix-proisxozhdenie
# Redirect 301 /cerkovnye-sobory-i-ix-proisxozhdenie.shtml /cerkovnye-sobory-i-ix-proisxozhdenie
/cerkovnye-sobory-i-ix-proisxozhdenie.shtml /cerkovnye-sobory-i-ix-proisxozhdenie [status=301]
# RewriteRule ^m-cerkovnye-sobory-i-ix-proisxozhdenie.shtml$ /m-cerkovnye-sobory-i-ix-proisxozhdenie [R=301,L]
^m-cerkovnye-sobory-i-ix-proisxozhdenie.shtml$ /m-cerkovnye-sobory-i-ix-proisxozhdenie
# RewriteRule ^dictionary/17/o_snovideniyah_\d+-all.shtml$ /o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam [R=301,L]
^dictionary/17/o_snovideniyah_\d+-all.shtml$ /o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam
# Redirect 301 /o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam.shtml /o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam
/o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam.shtml /o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam [status=301]
# RewriteRule ^m-o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam.shtml$ /m-o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam [R=301,L]
^m-o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam.shtml$ /m-o-snovideniyax-kak-xristianin-dolzhen-otnositsya-k-snovideniyam
# RewriteRule ^dictionary/17/simvol_very\d+-all.shtml$ /besedy-o-simvole-very [R=301,L]
^dictionary/17/simvol_very\d+-all.shtml$ /besedy-o-simvole-very
# Redirect 301 /besedy-o-simvole-very.shtml /besedy-o-simvole-very
/besedy-o-simvole-very.shtml /besedy-o-simvole-very [status=301]
# RewriteRule ^m-besedy-o-simvole-very.shtml$ /m-besedy-o-simvole-very [R=301,L]
^m-besedy-o-simvole-very.shtml$ /m-besedy-o-simvole-very
# RewriteRule ^dictionary/17/men_veruyu_besedy_\d+-all.shtml$ /veruyu-besedy-o-simvole-very [R=301,L]
^dictionary/17/men_veruyu_besedy_\d+-all.shtml$ /veruyu-besedy-o-simvole-very
# Redirect 301 /veruyu-besedy-o-simvole-very.shtml /veruyu-besedy-o-simvole-very
/veruyu-besedy-o-simvole-very.shtml /veruyu-besedy-o-simvole-very [status=301]
projects:
- map: ./azbyka2.map
prefix: /azbyka
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment