Redirect URL to a IP address - .htaccess

I need to redirect a url www.website.com/page to a Ip address 192.000.00.000:1234
Do i have to do this through the Cpanel or is there a way to do it in the .htaccess
Cant find anything that describes how to do it.
Thanks

Had to use
Redirect 301 /page.php http://192.000.00.000:1234
For it to work. Was on a wordpress site.

Have you tried:
Redirect 301 / 192.000.00.000:1234
?

Enable .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
RedirectMatch 301 ^/page\.php$ http://192.000.00.000:1234

Related

.htaccess 301 redirect to site B with referrer from site A

I am trying to make the following redirection with .htaccess
Redirect 301 pageA.php to https://newSite/pageB.php?referrer=pageA.php
I need the pageA.php to be redirected to another site along with a referrer from the origin site containing pageA.php
Is there a way to do this in htaccess?
Try below code
RewriteRule ^/pageA.php https://newSite/pageB.php?referrer=pageA.php [R=301,L]

How to redirect all pages in folder?

I have some old pages and I need to redirect them.
Example:
I need to redirect from:
www.domain.com/en/customer-detail/"customer_name"
to:
www.domain.com/de/customer-detail/"customer_name"
How can I do this?
Thx
You can use a simple redirect in your site root .htaccess:
RedirectMatch 301 ^/en/(customer-detai.*)$ /de/$1

Friendly URL or url-rewriting

I am working on a site that uses such a url
www.domain.com/hotels/hotel-name
I would like visitors just to see
www.domain.com/hotel-name
This can probably be done in the .htaccess file with a rewrite condition but I don't know how.
Thank you for helping
You can use RedirectMatch directive :
Put the following Redirect above other rules in your htaccess file
RedirectMatch 301 ^/hotels/([^/]+)/?$ /$1
This example would redirect all files from the /hotels/ folder, if you want to redirect a particular file from that folder , you can use the following:
RedirectMatch 301 ^/hotels/(file_name)/?$ /$1
Now if a visiter enters www.example.com/hotels/hotel-name then will be externally redirected to www.example.com/hotel-name

301 redirect from htaccess

I'm trying to create permanent redirects for outdated URL's on my site.
For example I have: www.mydomain.com/?v=tv and want it have a permanent 301 redirect to www.mydomain.com/tv.php
I tried this code in my htaccess file but it did not work:
Redirect /?v=tv http://mydomain.com/tv.php
Any Help?
RewriteRule ^tv.php$ http://guessthelogo.com/?v=tv [R=301,L]
I think your missing "301" after "Redirect":
Redirect 301 /?v=tv http://guessthelogo.com/tv.php

htaccess 301 subdomain moved

I want to redirect URLs like http://www.site.gen.tr/index.php?ind=reviews&op=entry_view&iden=2381 to http://arsiv.site.gen.tr?ind=reviews&op=entry_view&iden=2381 site.
I tried using .htaccess but could not make it work. Please help.
You should put this in your .htaccess file (need to be in domain root)
RewriteEngine On
Redirect 301 http://www.site.gen.tr/index.php?ind=reviews&op=entry_view&iden=2381 http://arsiv.site.gen.tr?ind=reviews&op=entry_view&iden=2381

Resources