O
O
ozonpromo2018-09-15 20:26:49
htaccess
ozonpromo, 2018-09-15 20:26:49

How to remove labels in url after 301 redirect?

There is a .htaccess file

DirectoryIndex index.html index.shtml index.pl index.cgi index.php

# SEO URL Settings
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/admin/
RewriteRule ^([^?]*)$ /index.php?path=$1 [NC,L,QSA]
RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]

# HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

I am doing a 301 redirect from one page to another
Redirect 301 /oldpage https ://site / newpage
After redirecting to a new page, tags appear in the url helps.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-09-16
@dodo512

The problem occurs when mod_alias and mod_rewrite are running at the same time

Redirect 301 /oldpage https://site/newpage

RewriteRule ^([^?]*)$ /index.php?path=$1 [NC,L,QSA]

You need to do a redirect using mod_rewrite
DirectoryIndex index.html index.shtml index.pl index.cgi index.php

RewriteEngine On
RewriteBase /

# HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC]
RewriteRule ^(.*)$ https://site.ru/$1 [R=301,L]

RewriteRule ^oldpage$ https://site.ru/newpage [R=301,L]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/admin/
RewriteRule ^([^?]*)$ /index.php?path=$1 [NC,L,QSA]

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question