I'm trying to redirect the following kind of URL:
https://my_store/product_thumb.php?img=images/my_image_example.jpg&w=120&h=120
to:
https://my_store/images/my_image_example.jpg
I tried the following without success:
`RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^product_thumb.php?img=images/(.*) images/$1 [NC,R=301,L]`
`RewriteCond %{HTTP_HOST} ^.*$
RewriteRule product_thumb.php?img=images?(.*)$ images/$1 [NC,R=301,L]
`
`RewriteCond %{QUERY_STRING} $img=images [NC]
RewriteRule ^/?$ /images [L,R=301]`
Found the solution:
RewriteCond %{QUERY_STRING} ^img=images/(.)&w=(.)&h=(.*)$
RewriteRule ^product_thumb.php$ images/%1? [L,R=301]
Related
RewriteEngine On
RewriteCond %{HTTP_HOST} !^domain.com.au [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http%1://domain.com.au/$1 [L,R,NE]
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^(.*)$ https://domain.com.au/$1 [R,L]
I am getting Redirect chain and errors, any help would be great
thank you
Redirect chain issues
I thought I had it right but when I type just example.com in the browser it isn't redirecting, I get the no server IP error.
Code I have now is:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
RewriteCond %{http_host} ^www.example.com$ [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
Cheers
Try this:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) https://www.example.com/$1 [R=301,L]
In Apache's httpd.conf file, how to rewrite module for making url's www to non-www and force http to https?
When I tried below, it becomes infinite redirection error
RewriteCond %{HTTP_HOST} ^www.(.*)$
RewriteRule ^(.*)$ https://example.com$1
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)$ https://example.com$1
or
RewriteCond %{HTTP_HOST} ^www.(.*)$ [OR]
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)$ https://example.com$1
To redirect from www/http to non-www/https, you can use :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\. [OR]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://example.com%{REQUEST_URI [NC,L,R]
I want to redirect the following domain names :haloservers.net,haloservers.nl and servers.xgclan.com to the domain name www.haloservers.us
I tried putting the code below in the htaccesses file but this didn't work.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.?)haloservers.net$
RewriteRule ^(.*)$ http://www.haloservers.us/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.?)haloservers.nl$
RewriteRule ^(.*)$ http://www.haloservers.us/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(servers\.)xgclan.com$
RewriteRule ^(.*)$ http://www.haloservers.us/$1 [R=301,L]
Try:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?haloservers\.net [NC]
RewriteRule ^(.*)\.html$ http://haloservers.us/$1 [R=301,L]
The following code fixed the problem.
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.*)haloservers(.nl|.net)$
RewriteRule ^(.*) http://www.haloservers.us/$1 [L,R=301]
RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?haloservers(.nl|.net) [NC]
RewriteRule ^(.*)\.html$ http://haloservers.us/$1 [R=301,L]
I got my solution from col-dejong # http://gathering.tweakers.net/forum/list_messages/1497390/last
I'd like to redirect all my traffic to my root domain, the root domain being a Splash screen. I'd like to do this ONLY when the %{HTTP_HOST} is not beta.example.(com|es|fr).
So I've tried the following in my .htaccess file, with no luck... (infinite loop... I guess it's not getting the REQUEST_URI condition, but cannot figure out why?? I've tried almost everything)
RewriteCond %{HTTP_HOST} !^beta\.example\.com$
RewriteCond %{HTTP_HOST} !^beta\.example\.es$
RewriteCond %{HTTP_HOST} !^beta\.example\.fr$
RewriteCond %{REQUEST_URI} !^/?$
RewriteRule ^.*$ / [NC,L,R=302]
At that point, I should have all my traffic but "beta" sub-domain redirected to the root domain. So now I'd like to Rewrite "backstage" the root domain with my Splash screen, following in the .htaccess file:
RewriteCond %{HTTP_HOST} !^beta\.example\.com$
RewriteCond %{HTTP_HOST} !^beta\.example\.es$
RewriteCond %{HTTP_HOST} !^beta\.example\.fr$
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ splash.phtml [NC,L]
Note: I'm using the Zend Framework, so these rules are following in the .htaccess file:
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
I must say, I'm stuck.
thx in advance
#bsagols
This line from Zend is going to screw you up for sure.
RewriteRule ^.*$ index.php [NC,L]
You need to put your directives above this, if not above all of the Zend stuff. If I'm understanding you correctly, try this:
RewriteCond "%{HTTP_HOST}" "!^beta\.example\.(com|es|fr)$" [NC]
RewriteCond "%{REQUEST_URI}" "!\.(js|ico|txt|gif|jpg|png|css)$" [NC]
RewriteRule ".*" "/splash.phtml" [R=302,L]