4

I am trying to redirect url as abc.xyz.org to 192.168.xx.yy:abcd using htaccess. tried using following in htaccess.

RewriteRule ^(.*)$ 192.168.xx.yy:abcd [P,R=301,L]

but this rule isn't taking the port number.What should I do? i tried

RewriteRule ^(.*)$ 192.168.xx.yy:abcd[b] [P,R=301,L]
Jason Wheeler
  • 872
  • 1
  • 9
  • 23
samjhana joshi
  • 1,995
  • 4
  • 35
  • 69
  • Tried this? http://stackoverflow.com/questions/3222725/htaccess-rewrite-to-another-port – vee Jan 02 '14 at 06:17
  • @vee Yeah I tried this too .. but to no avail ... it just don't access the port – samjhana joshi Jan 02 '14 at 06:27
  • There's some possibility that the client is redirected to `192.168.xx.yy:abcd` before it's immediately redirected to 192.168.xx.yy. Press `F12` in your browser (if supports), and see the network section carefully. – denkiryokuhatsuden Jan 24 '14 at 05:19

3 Answers3

1

Try this

RewriteEngine on
RewriteRule ^(.*)$ http://192.168.0.1:1234/$1 [R=301,L]
Wahyu Kristianto
  • 8,719
  • 6
  • 43
  • 68
0
RewriteRule ^(.*)$ http://192.168.xx.yy:abcd [P,R=301,L]

Your using [P] flag. Make sure mod_proxy is enabled. In this doc it says Note: mod_proxy must be enabled in order to use this flag. To enable mod_proxy give command

sudo a2enmod proxy

Then restart apache

If you can not enable mod_proxy [P] flag is of no use. Then your rewrite rule will be

RewriteRule ^(.*)$ http://192.168.xx.yy:abcd [R=301,L]
chanchal118
  • 3,551
  • 2
  • 26
  • 52
0
RewriteEngine On

RewriteRule ^(.*)$ index.php$1 [R=301, L]
Rizier123
  • 58,877
  • 16
  • 101
  • 156