Solved

rewrite rule inc port

Posted on 2008-11-03
4
148 Views
Last Modified: 2010-03-04
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
Comment
Question by:willa666
  • 2
4 Comments
 
LVL 43

Expert Comment

by:ravenpl
ID: 22869387
Into the .htaccess file

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

Author Comment

by:willa666
ID: 22871702
Hi ravenpl

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

Ww
0
 
LVL 43

Expert Comment

by:ravenpl
ID: 22871787
No, If You want other than the default port 80, You have to specify it.
0
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
ID: 22878542
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

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now