2016-11-16 1 views
0

У меня есть mod_rewrite config, который перенаправляет все запросы на маршрутизатор /index.php. Я хочу добавить новый маршрутизатор для какого-то пути, например: request to/path/action должен обрабатываться с /custom_engine/index.php. Как это сделать?Как добавить новый маршрутизатор в mod_rewrite

Мой существующий .htaccess:

<IfModule mod_rewrite.c> 
Options +FollowSymLinks 
RewriteEngine On 

# Get rid of index.php 
RewriteCond %{REQUEST_URI} /index\.php 
RewriteRule (.*) index.php?rewrite=2 [L,QSA] 

# Rewrite all directory-looking urls 
RewriteCond %{REQUEST_URI} /$ 
RewriteRule (.*) index.php?rewrite=1 [L,QSA] 

# Try to route missing files 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} public\/ [OR] 
RewriteCond %{REQUEST_FILENAME} \. (jpg|gif|png|ico|flv|htm|html|php|css|js)$ 
RewriteRule . - [L] 

# If the file doesn't exist, rewrite to index 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA] 

</IfModule> 

ответ

0
<IfModule mod_rewrite.c> 
Options +FollowSymLinks 
RewriteEngine On 

RewriteRule (path/action/)(.*) engine-v2/index.php [L,NC] 

# Get rid of index.php 
RewriteCond %{REQUEST_URI} /index\.php 
RewriteRule ^(path/action/)(.*) index.php?rewrite=2 [L,QSA] 

# Rewrite all directory-looking urls 
RewriteCond %{REQUEST_URI} /$ 
RewriteRule (.*) index.php?rewrite=1 [L,QSA] 

# Try to route missing files 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} public\/ [OR] 
RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$ 
RewriteRule . - [L] 

# If the file doesn't exist, rewrite to index 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA] 
</IfModule> 
Смежные вопросы