GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- HPE BladeSystem
- >
- Legacy
- >
- Networking
- >
- Apache RewriteRule
Networking
1857291
Members
12260
Online
110372
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
- Integrity Servers
- Server Clustering
- HPE NonStop Compute
- HPE Apollo Systems
- High Performance Computing
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp Software
Knowledge Base
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2009 01:12 AM
01-22-2009 01:12 AM
Apache RewriteRule
Looking for some help with what I would have though was a simple RewriteRule, but this is the first time I've had to do it.
A few sites we have are all under a single context root, so:
www.domain.com/root/site1
www.domain.com/root/site2
www.domain.com/root/site3
I want users to be able to hit www.domain.com/site1 and be forwarded. If this can be done without changing the URL in the browser then even better.
I've got as far as:
RewriteRule ^/(.*)$ /root/$1 [PT]
This redirects the first page fine, but if you hit any links in the web page they obviously still have the original context root, so this rule adds /root to it again, and the page cannot be found:
www.domain.com/root/site1/page1 becomes www.domain.com/root/root/site1/page1 and 404s.
I'm obviously missing something fundamental but mod-rewrite seems like a mine field.
Thanks!
A few sites we have are all under a single context root, so:
www.domain.com/root/site1
www.domain.com/root/site2
www.domain.com/root/site3
I want users to be able to hit www.domain.com/site1 and be forwarded. If this can be done without changing the URL in the browser then even better.
I've got as far as:
RewriteRule ^/(.*)$ /root/$1 [PT]
This redirects the first page fine, but if you hit any links in the web page they obviously still have the original context root, so this rule adds /root to it again, and the page cannot be found:
www.domain.com/root/site1/page1 becomes www.domain.com/root/root/site1/page1 and 404s.
I'm obviously missing something fundamental but mod-rewrite seems like a mine field.
Thanks!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP