Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
808 views
in Q2A Core by

I can't find out where i should put my url in this code. please help me as soon as possible.

 

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^([^/]+) $1 [L]
RewriteCond %{HTTP_HOST} ^surak-zhauap\.kz
RewriteRule ^(.*)$ http://szh.kz/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.surak-zhauap\.kz
RewriteRule ^(.*)$ http://szh.kz/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.szh\.kz
RewriteRule ^(.*)$ http://szh.kz/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^91.201.214.204
RewriteRule ^(.*)$ http://szh.kz/$1 [R=301,L]
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>
 

1 Answer

+1 vote
by

.httacess file edit.

www.yousite.com --->>  yousite.com

Options +FollowSymLinks
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} robots.txt$ [NC]
RewriteRule ^([^/]+) $1 [L]
RewriteCond %{HTTP_HOST} ^www.yousite\.com
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>
 
 
 

http://www.ask.dnoj.ir  --->>  ask.dnoj.ir

Options +FollowSymLinks
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} robots.txt$ [NC]
RewriteRule ^([^/]+) $1 [L]
RewriteCond %{HTTP_HOST} ^www.ask.dnoj\.ir
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>

 

If the site address has changed then you need to put like this.  

www.yousite.com -->> www.newyousite.com 

 

Options +FollowSymLinks
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} robots.txt$ [NC]
RewriteRule ^([^/]+) $1 [L]
RewriteCond %{HTTP_HOST} ^yousite\.com
RewriteRule ^(.*)$ http://newyousite.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.yousite\.com
RewriteRule ^(.*)$ http://newyousite.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.newyousite\.com
RewriteRule ^(.*)$ http://newyousite.com/$1 [R=301,L]
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>
by
Thanks it's work correctly. I use this one
--------------------------------------------------------------------------------------------------------
http://www.ask.dnoj.ir  --->>  ask.dnoj.ir
Options +FollowSymLinks
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} robots.txt$ [NC]
RewriteRule ^([^/]+) $1 [L]
RewriteCond %{HTTP_HOST} ^www.ask.dnoj\.ir
RewriteRule ^(.*)$ http://ask.dnoj.ir/$1 [R=301,L]
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>
--------------------------------------------------------------------------------------------------------

but some pages like
http://www.ask.dnoj.ir/%D9%82%D9%88%D8%A7%D9%86%DB%8C%D9%86 don't redirect to the

 http://ask.dnoj.ir/%D9%82%D9%88%D8%A7%D9%86%DB%8C%D9%86
please help me to solve this problem too
by
It's only work on ask.dnoj.ir  why? and whats the solution?
...