Answer the question
In order to leave comments, you need to log in
Problem with 301 redirect?
There is an old site that has been ported to SimplaCMS. The URL structure has changed and you need to redirect from old pages to new ones.
The xtacses file looks like this: (redirects at the end itself)
AddDefaultCharset UTF-8
ErrorDocument 404 /404
ErrorDocument 401 /password.php
RewriteEngine on
# Admin is now at /simpla
RewriteRule ^admin/?$ simpla [L]
# Product catalog
RewriteRule ^catalog/([^/]+)/?$ index.php?module=ProductsView&category=$1 [L,QSA]
RewriteRule ^catalog/([^/]+)/([^/]+)/?$ index.php?module=ProductsView&category=$1&brand=$2 [L ,QSA]
RewriteRule ^products/([^/]+)/?$ index.php?module=ProductView&product_url=$1 [L,QSA]
RewriteRule ^products/?$ index.php?module=ProductsView [L,QSA]
RewriteRule ^brands/([^/]+)/?$ index.php?module=ProductsView&brand=$1 [L,QSA]
RewriteRule ^brands/([^/]+)/page_([^/]+)/?$ index.php?module=ProductsView&brand=$1&page=$2 [L,QSA]
# Search for products
RewriteRule ^search/([^/]+)/?$ index.php?module=ProductsView&keyword=$1 [L,QSA]
RewriteRule ^search/?$ index.php?module=ProductsView [L,QSA]
# Blog
RewriteRule ^blog/([^/]+)/?$ index.php?module=BlogView&url=$1 [L,QSA]
RewriteRule ^blog/?$ index.php?module=BlogView [L,QSA]
# Trash and orders
RewriteRule ^cart/?$ index.php?module=CartView [L,QSA]
RewriteRule ^cart/([^/]+)/?$ index.php?module=CartView&add_variant=$1 [L,QSA]
RewriteRule ^cart /remove/([^/]+)/?$ index.php?module=CartView&delete_variant=$1 [L,QSA]
RewriteRule ^order/([^/]+)/?$ index.php?module=OrderView&url=$1 [L,QSA]
RewriteRule ^order/?$ index.php?module=OrderView [L,QSA]
# For users
RewriteRule ^user/login/?$ index.php?module=LoginView [L,QSA]
RewriteRule ^user/register/?$ index.php?module=RegisterView [L,QSA]
RewriteRule ^user/logout/?$ index. php?module=LoginView&action=logout [L,QSA]
RewriteRule ^user/password_remind/?$ index.php?module=LoginView&action=password_remind [L,QSA]
RewriteRule ^user/password_remind/([0-9a-z]+) /?$ index.php?module=LoginView&action=password_remind&code=$1 [L,QSA]
RewriteRule ^user/?$ index.php?module=UserView [L,QSA]
# Google sitemap
RewriteRule ^sitemap.xml?$ sitemap.php [L,QSA]
# XML
RewriteRule ^yandex.xml?$ yandex.php [L,QSA]
# feedback
RewriteRule ^contact/?$ index.php?module=FeedbackView [L,QSA]
#downloads
RewriteRule ^order/([^/]+)/([^/]+)/?$ index.php?module=OrderView&url=$1&file=$2 [L,QSA]
# Static pages
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/?$ index.php?module=PageView&page_url=$1 [L,QSA]
RewriteRule ^/?$ index.php?module=MainView&page_url= [L, QSA]
# Resize images on the fly
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^files/products/(.+) resize/resize.php?file=$1&token=%{QUERY_STRING}
#RewriteCond %{THE_REQUEST} ^GET\ (.*)files/products/(.*)\?([A-z0-9]*)
#RewriteRule ^files/products/(.+) resize/resize.php?file= %2&token=%3 [L,NE]
#migration of old pages
Redirect 301 /product_49.html www.site.ru/products/ololo1
Redirect 301 /product_94.html www.site.ru/products/nashlemnaja_lolo
Redirect 301 /product_174.html www.site.ru/products/lololo2
Redirect 301 /product_64. html www.site.ru/products/tovar
Redirect 301 /product_66.html www.site.ru/products/product2
Redirect 301 /product_173.html www.site.ru/products/product3
Answer the question
In order to leave comments, you need to log in
You have a rule # Статические страницы
.
Put the code #перенос старых страниц
before it.
I think that this rule still works
# Static pages
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/?$ index.php?module=PageView&page_url=$1 [L,QSA]
RewriteRule ^/?$ index.php?module=MainView&page_url= [L,QSA]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question