• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

rewrite rule inc port

I need a rewrite rule that will rewrite the url to do the following:

if url http://domain.com:81/anything rewrite to http://domain.com:81/app/con/index.jsp

Also i dont really want to specify the domain/cname in the rule
0
willa666
Asked:
willa666
  • 2
1 Solution
 
ravenplCommented:
Into the .htaccess file

RewriteEngine On
RewriteCond %{SERVER_PORT} =81
RewriteRule ^anything.* http://domain.com:81/app/con/index.jsp [R=301,L]
0
 
willa666Author Commented:
Hi ravenpl

Is there a way of not specifing the "http://domain.com:81?

Ww
0
 
ravenplCommented:
No, If You want other than the default port 80, You have to specify it.
0
 
caterham_wwwCommented:
At least my version is able to build a correct self-referencing URI with the correct port:
RewriteEngine On
RewriteCond %{SERVER_PORT} =81
RewriteRule ^anything /app/con/index.jsp [R=301,L]

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now