V
V
Vadim Remin2015-02-17 19:33:22
PHP
Vadim Remin, 2015-02-17 19:33:22

How to solve the redirect problem on the local copy of the site?

I am newbie.
The client's website works fine on the hosting. On hosting, it is located in the site-decor.ru folder (the name of the site is not real here). At the same time, with the help of .htaccess (content below), a redirect to site-d.ru is registered. I copied from ftp all its contents of the site-decor.ru folder to my hard drive to the folder with Open Server domains. Restarted the server. In my local hosts file, Open Server automatically registered site-decor.ru. But when you try to access site-decor.ru through a browser, a redirect to site-d.ru naturally occurs, and of course, to a real hosted site.
I'm trying to solve this problem. Tried:
1) Comment out the first paragraph with RewriteCond RewriteRule - 404 when trying to enter through the browser.
2) Specify in the Open Server settings an additional site-d.ru domain. It is written in the hosts file, but the browser still returns 404 after the redirect.
3) Rename the local folder with the site to site-d.ru - 404.
What should be done here? Thank you in advance!

Options +FollowSymLinks
RewriteEngine on 

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


RewriteCond %{REQUEST_URI} !^/\$/main.php [NC] 
RewriteCond %{REQUEST_URI} !^/\$ [NC] 
RewriteCond %{REQUEST_URI} !.*(gif|jpg|ico|swf|png)$ [NC] 
RewriteCond %{REQUEST_URI} !.*(css|php|js)$ [NC] 
RewriteCond %{REQUEST_URI} !.*(csv|xls|xlsx|txt|htm)$ [NC] 
RewriteCond %{REQUEST_URI} !.*(avi|zip|pdf|exe|flv|doc|docx)$ [NC] 
RewriteCond %{REQUEST_URI} !.*(eot|woff|ttf)$ [NC] 
RewriteCond %{REQUEST_URI} !.*(xml|xsl)$ [NC] 
RewriteRule (.*) /$/main.php%{REQUEST_URI} [L]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
ShamblerR, 2015-02-18
@ShamblerR

Mde
This is a redirect from a slash to without a slash.
All you have to do is comment them out, that's all.

#RewriteCond %{HTTP_HOST} ^site-decor\.ru$ [NC]
#RewriteRule ^(.*)$ http://site-d.ru/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^www.site-decor\.ru$ [NC]
#RewriteRule ^(.*)$ http://site-d.ru/$1 [R=301,L]
#RewriteCond %{HTTP_HOST} ^www.site-d\.ru$ [NC]
#RewriteRule ^(.*)$ http://site-d.ru/$1 [R=301,L]

F
FanatPHP, 2015-02-17
@FanatPHP

Why is this redirect needed at all? Have you tried removing it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question