Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7093643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:27:54+00:00 2026-05-28T08:27:54+00:00

I am hosting a zend framework project on a subdomain. Lets say, project.mydomain.com .

  • 0

I am hosting a zend framework project on a subdomain. Lets say, project.mydomain.com. This domain however can be accessed from mydomain.com/project as well. Now, to avoid the complexity of having to maintain two different cases, I am trying to minimize the complexity by redirecting the directly accessed path to the subdomain, i.e.

mydomain.com/project > project.mydomain.com

but, if the same direcoty is accessed using subdomain, then i want some rules to be applied to it as well.

Here is my currect .htaccess which is allowing me to use direct path i.e mydomain.com/project/

RewriteEngine On

# Exclude some directories from URI rewriting
#RewriteRule ^(dir1|dir2|dir3) - [L]

RewriteRule ^\.htaccess$ - [F]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /projects/myproject.com/public/index.php [NC,L]

RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /projects/myproject.com/public/$1

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

RewriteRule ^public/.*$ /projects/myproject.com/public/index.php [NC,L]

Next, I will write a .htaccess for subdomain only. But, I want the directly accessed path to be redirected to the subdomain. How to do this redirection through .htaccess?

Please note, redirecting through a php file is not a option.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:27:55+00:00Added an answer on May 28, 2026 at 8:27 am

    Robin, it looks like you are trying to redirect the path mydomain.com/projects to projects.mydomain.com. So, I dont think this is going to be combined .htaccess. As you would need, pretty much everything from /projects/your-anotherproject to has to be redirected to projects.mydomain.com/your-anotherproject. Rewriting htaccess for every projects is a BAD idea.

    If this is the case, then i suggest having a simple .htaccess on projects/ root instead

    RewriteEngine On
    RedirectMatch 301 ^/projects/(.*)$ http://projects.mydomain.com/$1
    

    This will solve you all cases, for all subdirectory, on that subdomain. Now write your project specific .htaccess in the project’s root, like you are doing above

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I developed a project on Zend Framework on Ubuntu. I created a virtual host
Is there a problem with a Zend framework site and windows web hosting? The
I have a Zend Framework PHP project that I am serving with Apache. I
My hosting company recently upgraded me from Apache 1 to Apache 2, and I've
I am hosting SpiderMonkey in a current project and would like to have template
I have recenlty stumbled into Zend Lucene port of Lucene project. I have a
Hello my fellow Stackoverflownians :), I just came across this thing called Zend. And
Based on recommendations on SO for the Zend framework, I'm planning to use it
I am using PHP and the codeigniter framework for a project I am working
Currently PHP 5.3 hosting environments have to install and use Zend Guard Loader extension

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.