Jump to content
Sign in to follow this  
aromantsov

Убрать слеши в конце урлов

Recommended Posts

Помогите, пожалуйста. 

 

На сайте часть страниц со слешами в конце страниц, часть без. Наобходимо избавиться от слешей во всех урлах. После вставки в .htaccess директивы 

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $1 [R=301,L]

страницы со слешами перестали открываться, при этом при перезагрузке страницы слеш периодически появляется-пропадает.

 

htaccess полностью 

 

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +SymLinksIfOwnerMatch

# Prevent Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))">
 Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $1 [R=301,L]

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none

Redirect 301 /categories/aromaterapiya /index.php?route=common/home
# Redirect 301 /about.html /index.php?route=information/information&information_id=3644
# Redirect 301 /contact.html /index.php?route=information/contact
Redirect 301 /dostavka/oplata.html /index.php?route=information/information&information_id=3645

<IF "false">
# Redirect 301 /katalog-tovarov/semena/ /index.php?route=product/category&path=86
# Redirect 301 /katalog-tovarov/semena/kapusta-krasnokachannaya/ /index.php?route=product/category&path=86_182
# Redirect 301 /katalog-tovarov/semena/luk/ /index.php?route=product/category&path=86_154
# Redirect 301 /katalog-tovarov/semena/zelen/ /index.php?route=product/category&path=86_192
# Redirect 301 /katalog-tovarov/semena/pomidoryi/tomat-ekzotika/ /index.php?route=product/category&path=86_139_218
# Redirect 301 /katalog-tovarov/semena/pomidoryi/ /index.php?route=product/category&path=86_139
# Redirect 301 /katalog-tovarov/semena/baklazhan/ /index.php?route=product/category&path=86_149
# Redirect 301 /katalog-tovarov/semena/tyikva/ /index.php?route=product/category&path=86_191
# Redirect 301 /katalog-tovarov/semena/gazonnyie-travyi/ /index.php?route=product/category&path=86_806
# Redirect 301 /katalog-tovarov/semena/kapusta-brokkoli/ /index.php?route=product/category&path=86_312
# Redirect 301 /katalog-tovarov/semena/arbuzyi/ /index.php?route=product/category&path=86_87
# Redirect 301 /katalog-tovarov/semena/kapusta-pekinskaya/ /index.php?route=product/category&path=86_187
# Redirect 301 /katalog-tovarov/semena/kapusta/rannij-sort/ /index.php?route=product/category&path=86_150_165
# Redirect 301 /katalog-tovarov/semena/salat/ /katalog-tovarov/semena/salat/
# Redirect 301 /katalog-tovarov/semena/shpinat/ /index.php?route=product/category&path=86_1098
# Redirect 301 /katalog-tovarov/semena/svekla-kormovaya/ /index.php?route=product/category&path=86_180
# Redirect 301 /katalog-tovarov/semena/kapusta/ /index.php?route=product/category&path=86_150
# Redirect 301 /katalog-tovarov/semena/dyinya/ /index.php?route=product/category&path=86_151
# Redirect 301 /katalog-tovarov/semena/fasol/ /index.php?route=product/category&path=86_514
# Redirect 301 /katalog-tovarov/semena/kabachok/ /index.php?route=product/category&path=86_152
# Redirect 301 /katalog-tovarov/semena/morkov/ /index.php?route=product/category&path=86_155
# Redirect 301 /katalog-tovarov/semena/pomidoryi/rannie/abelus-f1-abellus-f1.html /index.php?route=product/product&path=86_139_145&product_id=4142
# Redirect 301 /katalog-tovarov/semena/luk/luk-porej/forrest-forrest.html /index.php?route=product/product&path=86_154_349&product_id=350
# Redirect 301 /katalog-tovarov/semena/gorox-ovoshhnoj/ /index.php?route=product/category&path=86_196
# Redirect 301 /katalog-tovarov/semena/kapusta-krasnokachannaya/ /index.php?route=product/category&path=86_182
# Redirect 301 /katalog-tovarov/semena/svekla-stolovaya/ /index.php?route=product/category&path=86_176
# Redirect 301 /katalog-tovarov/semena/selderej/ /index.php?route=product/category&path=86_382
# Redirect 301 /katalog-tovarov/sredstva-zashhityi/insekticzidyi/ /index.php?route=product/category&path=96_2371
# Redirect 301 /katalog-tovarov/sredstva-zashhityi/insekticzidyi/aplaud.html /index.php?route=product/product&path=96_2371&product_id=3242
# Redirect 301 /katalog-tovarov/sredstva-zashhityi/insekticzidyi/aktara-25-wg-v.g/ /index.php?route=product/product&path=96_2371&product_id=2372
# Redirect 301 /katalog-tovarov/sredstva-zashhityi/gerbiczidyi/ /index.php?route=product/category&path=96_2368
# Redirect 301 /katalog-tovarov/sredstva-zashhityi/gerbiczidyi/betanal-maks-pro.html /index.php?route=product/product&path=96_2368&product_id=3289
# Redirect 301 /katalog-tovarov/sredstva-zashhityi/gerbiczidyi/stomp-basf.html /index.php?route=product/product&path=96_2368&product_id=2693
# Redirect 301 /katalog-tovarov/sredstva-zashhityi/gerbiczidyi/astera.html /index.php?route=product/product&path=96_2368&product_id=3287
# Redirect 301 /katalog-tovarov/sredstva-zashhityi/fungiczidyi/ /index.php?route=product/category&path=96_2369
# Redirect 301 /katalog-tovarov/udobreniya/ /index.php?route=product/category&path=121
# Redirect 301 /katalog-tovarov/melkaya-fasovka-semyan/semena-redisa/tetra-iloveczka-tetra-ilovecka.html /index.php?route=product/product&path=4148_4584&product_id=5566
# Redirect 301 /kassetyi-dlya-rassadyi/ /index.php?route=product/category&path=2300
</IF>

### Display PHP errors 
### Uncomment the commands by removing the # sign in front of it.
# php_flag display_startup_errors on
# php_flag display_errors on
# php_flag html_errors on
# php_flag track_errors on
# php_value error_reporting "E_ALL"
 

Share this post


Link to post
Share on other sites

Может просто поставить\включить seopro?

Share this post


Link to post
Share on other sites
49 хвилин назад, wbDev сказав:

Может просто поставить\включить seopro?

SeoPro включен

Share this post


Link to post
Share on other sites
7 минут назад, aromantsov сказал:

SeoPro включен

Тогда  в товарах, категориях и инфостраницах должны быть слешы, а на технических, вроде личного кабинета, нет. Если работает не как на демо, значит что-то накрутили

Edited by wbDev

Share this post


Link to post
Share on other sites
3 хвилини назад, wbDev сказав:

Тогда  в товарах, категориях и инфостраницах должны быть слешы, а на технических, вроде личного кабинета, нет. Если работает не как на демо, значит что-то накрутили

Все работает примерно так, как на демо. Но, мне необходимо отсутствие слеша на всех страницах, включая каатегории и инфостраницы

Share this post


Link to post
Share on other sites
2 минуты назад, aromantsov сказал:

Все работает примерно так, как на демо. Но, мне необходимо отсутствие слеша на всех страницах, включая каатегории и инфостраницы

В файле seo_pro.php

$seo_url .= '/'; на $seo_url .= '';

 

Share this post


Link to post
Share on other sites
2 хвилини назад, wbDev сказав:

В файле seo_pro.php

$seo_url .= '/'; на $seo_url .= '';

 

Это уже исправлено - не помогает

Share this post


Link to post
Share on other sites
5 минут назад, aromantsov сказал:

Это уже исправлено - не помогает

case 'path':
						$categories = explode('_', $value);
						foreach ($categories as $category) {
							$queries[] = 'category_id=' . $category;
						}
						unset($data[$key]);
						break;

					default:
						break;

заменить на

case 'path':
						$categories = explode('_', $value);
						foreach ($categories as $category) {
							$queries[] = 'category_id=' . $category;
						}
						unset($data[$key]);
						$postfix = 1;
						break;

					default:

Кеш очистите, это чтобы в категориях не было. А технические страницы вообще надо закрыть от индекесации, а не слешики в них убирать

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.