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

  • SEARCH
  • Home
  • 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 8150779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:09:57+00:00 2026-06-06T15:09:57+00:00

Our web server is structured as follows /path-to-docdir [Contains main pages] ./app/ [Some application

  • 0

Our web server is structured as follows

/path-to-docdir     [Contains main pages]
        ./app/      [Some application not directly related to the main content]

The main pages are served fine. In the app directory I am trying to use mod_rewrite to redirect all pages to an index.php in a public directory

So a request to

/server/app/start/login/ => /server/app/public/index.php 
/server/app/start/login  => /server/app/public/index.php
/server/app/start/login?name=someone => /server/app/public/index.php?name=someone

The front controller relies on the last two components of the REQUEST_URI string to interpret controller and action.

To do the above I have created the following .htaccess file in the app directory

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteRule ^$     public/   [L]
  RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Here, I find that the server goes in a redirect loop for the above URLs. I tried replacing $1 with index.php and that does bring up the page, but the internal references within the page to script files run into errors.

After some searching around, I added the following line:

RewriteBase /app/

And that did not seem to make any difference. I should also note that everything works as expected if I make the app directory as the server root directory.

I’ve also turned on debug logging and all I could gather from that was that the server was indeed going into a redirect loop.

[perdir /path-to-docdir/app/] internal redirect with /app/public/public/public/public/public/public/public/public/public/public/public/start/login/ [INTERNAL REDIRECT]

I’m not really sure where to start looking at this point, so any help or pointers to move me further would be much appreciated.

Edit:

This htaccess file worked for me – if anyone else is looking for a solution. Apparently, I was missing rewrite conditions

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php?$1 [L]
</IfModule>
  • 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-06-06T15:09:59+00:00Added an answer on June 6, 2026 at 3:09 pm

    A few points:

    A RewriteBase path does not need a trailing slash, so RewriteBase /app/ should be RewriteBase /app.

    RewriteRule ^(.*)$ public/$1 makes RewriteRule ^$ public/ superfluous. The former will match http://yourserver/app and internally rewrite as http://yourserver/app/public, so there’s no need for the latter.

    Finally, try adding a rewrite condition:

    RewriteEngine On
    RewriteBase /app
    RewriteCond %{REQUEST_URI} !^/app/public/
    RewriteRule ^(.*)$ public/$1 [L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

One of the pages in our web application polls the server approximately every 10
We are currently calling web services on our application server through our web server
We built some war files for our web server a while back and have
I am just testing an app to get data off our web server, previously
We generate reports in our web application by querying our sql server for data
We deploy our .net web application in six server(each with one copy) to get
If we are to separate our web server and app server, would we need
We have a .NET web application installed on our server at the location: C:\Inetpub\fmtool\
We have an app that basically parsers some web pages. The thing is the
One of our products implements the following one-way web service structure: Server <--------------------- Middleware

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.