IP redirect
 
Balonar 19. dec 2014 10:41:34 Pridružen od:
27. jan 2008
2350 objav
2609 255 41
#1

Zdravo



Kako lahko v htaccessu redirectam specific IP na določeno domeno?



Našel sem neke primere na netu,pa noben ne deluje



Hvala


všeč(0) ni všeč(0) spam(0)
 
krejzi 19. dec 2014 11:43:10 Pridružen od:
14. mar 2013
558 objav
915 213 12
#2

To more delat:



RewriteEngine On



If it's not your IP address



RewriteCond %{REMOTE_ADDR} !^1.2.3.4$



Redirect /abc to example.com/abc.



RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]



1.2.3.4 je IP


všeč(0) ni všeč(0) spam(0)
 
Balonar 19. dec 2014 11:58:32 Pridružen od:
27. jan 2008
2350 objav
2609 255 41
#3

ne dela ..



tole je WP htaccess


RewriteEngine On
# If it's not your IP address
RewriteCond %{REMOTE_ADDR} !^89\.212\.151\.31$
# Redirect /abc to example.com/abc.
RewriteRule ^(.*)$ http://disney.com/$1 [R=301,L]
# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
</IfModule>
AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
<IfModule mod_mime.c>
# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml
</IfModule>
</IfModule>
# END W3TC Browser Cache
# BEGIN W3TC Page Cache core
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=W3TC_ENC:_gzip]
RewriteCond %{HTTP_COOKIE} w3tc_preview [NC]
RewriteRule .* - [E=W3TC_PREVIEW:_preview]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f
RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
</IfModule>
# END W3TC Page Cache core
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
všeč(0) ni všeč(0) spam(0)
 
SlimDeluxe 19. dec 2014 12:12:44 Pridružen od:
29. apr 2010
1223 objav
1022 144 9
#4

krejzi:

To more delat:



RewriteEngine On



If it's not your IP address



RewriteCond %{REMOTE_ADDR} !^1.2.3.4$



Redirect /abc to example.com/abc.



RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]



1.2.3.4 je IP




On želi samo določen IP preusmeriti, ne pa vse ostale, torej:

RewriteCond %{REMOTE_ADDR} ^1.2.3.4$


všeč(1) ni všeč(0) spam(0)
Freelance Web Developer
 
krejzi 19. dec 2014 12:13:36 Pridružen od:
14. mar 2013
558 objav
915 213 12
#5

vrzi kodo na drugo mesto:



BEGIN W3TC Browser Cache



<IfModule mod_deflate.c>

<IfModule mod_headers.c>

Header append Vary User-Agent env=!dont-vary

</IfModule>

AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json

<IfModule mod_mime.c>

# DEFLATE by extension

AddOutputFilter DEFLATE js css htm html xml

</IfModule>

</IfModule>



END W3TC Browser Cache



BEGIN W3TC Page Cache core



<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP:Accept-Encoding} gzip

RewriteRule .* - [E=W3TCENC:gzip]

RewriteCond %{HTTPCOOKIE} w3tcpreview [NC]

RewriteRule .* - [E=W3TCPREVIEW:preview]

RewriteCond %{REQUESTMETHOD} !=POST

RewriteCond %{QUERY
STRING} =""

RewriteCond %{REQUESTURI} \/$

RewriteCond %{HTTP
COOKIE} !(commentauthor|wp-postpass|w3tcloggedout|wordpressloggedin|wptouchswitchtoggle) [NC]

RewriteCond "%{DOCUMENT
ROOT}/wp-content/cache/pageenhanced/%{HTTPHOST}/%{REQUESTURI}/index%{ENV:W3TCPREVIEW}.html%{ENV:W3TCENC}" -f

RewriteRule .* "/wp-content/cache/pageenhanced/%{HTTPHOST}/%{REQUESTURI}/index%{ENV:W3TCPREVIEW}.html%{ENV:W3TCENC}" [L]

</IfModule>



END W3TC Page Cache core



BEGIN WordPress



<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /



dizni



RewriteCond %{REMOTE_ADDR} ^89.212.151.31$

RewriteRule ^(.*)$ http://disney.com/$1 [R=301,L]



/dizni



RewriteRule ^index.php$ - [L]

RewriteCond %{REQUESTFILENAME} !-f

RewriteCond %{REQUEST
FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>



END WordPress


všeč(0) ni všeč(0) spam(0)
 
Balonar 19. dec 2014 12:47:35 Pridružen od:
27. jan 2008
2350 objav
2609 255 41
#6

ok .. malo dlje sem ze s popravljeno kodo ...



sedaj pa mi vrze ven error



The requested URL /wp-content/cache/pageenhanced/www.mojdadomena.si/index.html_gzip was not found on this server.


všeč(0) ni všeč(0) spam(0)
 
Balonar 13. mar 2015 18:32:15 Pridružen od:
27. jan 2008
2350 objav
2609 255 41
#7

hja .. tale koda deluje čist fajn


# dizni
RewriteCond %{REMOTE_ADDR} ^89\.212\.151\.31$
RewriteRule ^(.*)$ http://disney.com/$1 [R=301,L]
# /dizni

kako pa to urediti glede na to, da WP oz. Woocommerce po svoje "šlihta" htaccess in za vsako zbriše to kodo?


všeč(0) ni všeč(0) spam(0)
 
krejzi 13. mar 2015 23:00:43 Pridružen od:
14. mar 2013
558 objav
915 213 12
#8

Definiraj pravilo v vhostu od Apache serverja in dodaj za wordpress direktorij AllowOverride None


všeč(0) ni všeč(0) spam(0)
 
 

🔒 Za odgovor na to temo se moraš prijaviti.

Prijavi se