Solved

htaccess, rewritecond help

Posted on 2006-11-23
3
401 Views
Last Modified: 2012-06-21
Hello

I need some help with htaccess.

What i have currently:
- if user types in main domain (mydomain.com) he sees main page
- if user types in his subdomain (subdomain.mydomain.com) he sees his own page
- if user types in his addon domain (addondomain.com) he sees his own page (same as above with subdomain but this time with domain name)

This is working just fine they way it should!
In htaccess all i used was this:

RewriteRule ^index.php$ index.php?domain=%{HTTP_HOST}

and i do the rest of the stuff in PHP, check what domain name was entered or subdomain if any...

But now on main page i have subpages and while they are really PHP files i want them to show like mydomain.com/page1.html which would redirect to index.php?domain=mydomain.com&pageid=page1

So i did it like this:

RewriteRule ^([A-Za-z0-9_]+).html$ index.php?domain=%{HTTP_HOST}&pageid=$1
RewriteRule ^index.php$ index.php?domain=%{HTTP_HOST}

Still the same!
If i remove last line then of course the .html links work but subdomains and addon domains show mydomain.com page instead of users page.

I'm guessing that RewriteCond will need to be used and i have tried a few things but cannot get it working..
0
Comment
Question by:TheRudy
3 Comments
 
LVL 13

Accepted Solution

by:
rhickmott earned 125 total points
ID: 18003582
What about

RewriteRule ^([A-Za-z0-9_]+)\.html$ index.php?domain=%{HTTP_HOST}&pageid=$1 [L]
RewriteRule ^index\.php$ index.php?domain=%{HTTP_HOST} [L]

The L means it will stop processing rules if it has been matched (if the first one matches ignore the second)
0

Featured Post

Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

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…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

749 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