I have a domain
http://mydomain.com/
And i need redirect from this link
http://mydomain.com/?http://example.com
to
http://example.com
Thanks.
This should work for you:
RewriteEngine on
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /\?(.*)\ HTTP
RewriteRule ^ %2\? [R=301,L]
Related
I want to redirect following URL
http://www.example.com/friends/view.php?l=ka&id=21903
Into this page
http://www.example.com/hello.html
How can I do this using htaccess?
You can use the following rule in htaccess :
RewriteEngine on
RewriteCond %{THE_REQUEST} \s/friends/view\.php\?l=ka&id=21903\s [NC]
RewriteRule ^ http://example.com/hello.html? [L,R]
Is it possible to redirect with htaccess, from
http://example.com/redirect.php?url=http%3A%2F%2Fanother.com%2Fsmiley.gif
to url parameter,
http://another.com/smiley.gif
Please advice.
You can use this :
RewriteEngine on
RewriteCond %{THE_REQUEST} /redirect\.php\?url=.+([^/]+\.gif)\s [NC]
RewriteRule ^ http://another.com/%1? [NE,L,R]
This will redirect /redirect.php?url=foobar/foobar.gif to http://another.com/foobar.gif .
i want to redirect this please guide me
form
http://example.com/babycare/testimonials.php?id=7
to
http://example.com/babycare/testimonial/cat/1
To redirect
http://example.com/babycare/testimonials.php?id=7
to
http://example.com/babycare/testimonial/cat/1
You can use the following rule :
RewriteEngine on
RewriteCond %{THE_REQUEST} /babycare/testimonials\.php\?id=([0-9]+) [NC]
RewriteRule ^ /babycare/testimonial/cat/%1? [L,R]
I want to redirect all page from https to http using this code.
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ http://aplauz.media.pl/$1 [R=301,L]
It works!
I want to redirect specific file https to http in the same time.
Redirect 301 /aktualnosci/155-rusza-kampania-promujaca-w-polsce-rosji-i-chinach/ http://aplauz.media.pl/blog/rusza-kampania-promujaca-w-polsce-rosji-chinach/
It works as well!
BUT NEVER BOTH because browser inform me about double redirection.
Anyone can help me?
You can use:
RewriteEngine On
RewriteRule ^aktualnosci/155-rusza-kampania-promujaca-w-polsce-rosji-i-chinach/ http://aplauz.media.pl/blog/rusza-kampania-promujaca-w-polsce-rosji-chinach/ [L,NC,R=302]
RewriteCond %{HTTPS} on
RewriteRule ^ http://aplauz.media.pl%{REQUEST_URI} [R=302,NE,L]
i.e. keep specific redirect rule before generic catch-all rule.
I have a condition for url redirect like,
www.domain.com/something/anotherthing/index.php
i need the above url to redirect to
www.domain.com/something/anotherthing/
If i go to
www.domain.com/index.php/something/anotherthing
i want to redirect to
www.domain.com/something/anotherthing
i have a redirect htaccess rule for this
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index.php$1 [NC]
RewriteRule ^ /%1$1 [R=301,L]
But this works for the first condition but in the later it redirect me to the root page. Can anyone please help in this redirection.
Thanks in Advance.
Try something like this:
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index.php/?([^\ \?]*) [NC]
RewriteRule ^ %1/%2 [R=301,L]
That should handle any location of /index.php.