File tree Expand file tree Collapse file tree 5 files changed +36
-26
lines changed Expand file tree Collapse file tree 5 files changed +36
-26
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
7
7
## [ Unreleased]
8
8
### Added
9
- ### Changed
10
- ### Removed
11
- ### Fixed
9
+
10
+ - Cronjob that generates rewrite map files for each store and redirect type
Original file line number Diff line number Diff line change 13
13
14
14
---
15
15
16
- Generate RewriteMap files for Apache from Magento URL rewrites
16
+ Generate RewriteMap files for Apache from custom Magento URL rewrites (redirects). This can be useful to re-use the rewrites in a different frontend.
17
+
18
+ For example, to use the redirects in ** Vue Storefront** , a reverse proxy that uses the generated rewrite maps can be configured.
17
19
18
20
## Installation
19
21
@@ -29,8 +31,17 @@ Generate RewriteMap files for Apache from Magento URL rewrites
29
31
30
32
## Configuration
31
33
34
+ In your store configuration navigate to *Catalog > SEO*:
35
+
36
+ - **Enable Rewrite Maps Generation**: set to "yes" to enable (Default: no)
37
+ - **Rewrite Maps Generation Cron Schedule**: configure, when rewrite maps are regenerated (Default: every hour)
38
+
32
39
## Usage
33
40
41
+ Rewrite maps are stored in `var/rewrite_maps` as one text file per store and redirect type (301, 302).
42
+
43
+ See http://httpd.apache.org/docs/current/rewrite/rewritemap.html for details how to use those files.
44
+
34
45
## Changelog
35
46
36
47
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
Original file line number Diff line number Diff line change 3
3
4
4
namespace IntegerNet \RewriteMap \Cron ;
5
5
6
- use IntegerNet \RewriteMap \Model \RewriteMapsSavingService as RewriteMapsSavingService ;
6
+ use IntegerNet \RewriteMap \Model \RewriteMapsSavingService ;
7
7
use Magento \Framework \App \Config \ScopeConfigInterface ;
8
- use Magento \Framework \Exception \FileSystemException as FileSystemException ;
8
+ use Magento \Framework \Exception \FileSystemException ;
9
9
use Magento \Framework \Exception \InputException ;
10
- use Psr \Log \LoggerInterface as LoggerInterface ;
10
+ use Psr \Log \LoggerInterface ;
11
11
12
12
class GenerateRewriteMaps
13
13
{
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" ?>
2
- <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:module:Magento_Config:etc/system_file.xsd" >
3
- <system >
4
- <section id =" catalog" >
5
- <group id =" seo" >
6
- <field id =" rewrite_maps_generation_enabled" showInDefault =" 1" showInStore =" 1" showInWebsite =" 1"
7
- sortOrder =" 500" translate =" label" type =" select" >
8
- <label >Enable Rewrite Maps Generation</label >
9
- <comment >
10
- <![CDATA[ Enables the generation of rewrite maps files from the Magento UrlRewrites.
2
+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi : noNamespaceSchemaLocation =" urn:magento:module:Magento_Config:etc/system_file.xsd" >
4
+ <system >
5
+ <section id =" catalog" >
6
+ <group id =" seo" >
7
+ <field id =" rewrite_maps_generation_enabled" showInDefault =" 1" sortOrder =" 500" translate =" label"
8
+ type =" select" >
9
+ <label >Enable Rewrite Maps Generation</label >
10
+ <comment >
11
+ <![CDATA[ Enables the generation of rewrite maps files from the Magento UrlRewrites.
11
12
The files are saved under
12
13
path_to_magento/var/rewrite_map/map/rewrite-map-[REDIRECT_TYPE]-store-[STORE_ID].txt]]>
13
- </comment >
14
+ </comment >
14
15
<source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
15
- </field >
16
- <field id =" rewrite_maps_generation_cron_schedule" showInDefault =" 1" showInStore = " 1 " showInWebsite = " 1 "
17
- sortOrder = " 510 " translate = " label " type =" text" >
18
- <label >Rewrite Maps Generation Cron Schedule</label >
19
- </field >
20
- </group >
21
- </section >
22
- </system >
16
+ </field >
17
+ <field id =" rewrite_maps_generation_cron_schedule" showInDefault =" 1" sortOrder = " 510 " translate = " label "
18
+ type =" text" >
19
+ <label >Rewrite Maps Generation Cron Schedule</label >
20
+ </field >
21
+ </group >
22
+ </section >
23
+ </system >
23
24
</config >
Original file line number Diff line number Diff line change 6
6
use IntegerNet \RewriteMap \Model \RewriteMapRepository ;
7
7
use Magento \Store \Api \StoreRepositoryInterface ;
8
8
use Magento \TestFramework \Helper \Bootstrap ;
9
- use Magento \UrlRewrite \Model \OptionProvider ;
10
9
use PHPUnit \Framework \TestCase ;
11
10
12
11
/**
You can’t perform that action at this time.
0 commit comments