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 6683671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:50:55+00:00 2026-05-26T04:50:55+00:00

Here is my .htaccess: Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteCond %{REQUEST_FILENAME} -d RewriteRule

  • 0

Here is my .htaccess:

Options +FollowSymLinks  
Options +Indexes  
RewriteEngine On  
RewriteCond %{REQUEST_FILENAME} -d  
RewriteRule ([^/]+/.*) index.php?dir=%{REQUEST_URI}  

The htaccess lives in test.com/main/.htaccess
I can access test.com/main/ and test.com/index.php fine
test.com/main/directory gets rewritten to test.com/main/index.php?dir=/main/directory/ BUT test.com/main/directory stays in the url bar. This is good.

The problem is when I try to access sub-sub directories. When I access test.com/main/foler1/folder2 it gets rewritten to index.php?dir=/main/folder1/folder2/. This is also good, however test.com/main/folder1/folder2/?dir=/main/folder1/folder2/ shows up in the address bar instead of keeping test.com/main/folder1/folder2 in the url bar. This is the problem.

I want all sub directories, not just the direct children of main to keep the directory in the url bar while rewriting. The direct children do this fine, but any directories under that rewrite in a way where my get variables show up.

The purpose of this rewrite is so I don’t have to copy in an index.php file into every newly created folder so copying the .htaccess into each folder defeats the purpose.

  • 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-26T04:50:56+00:00Added an answer on May 26, 2026 at 4:50 am

    I’ll add the solution I found while testing mootinator’s solution.

    Instead of linking to
    test.com/main/foler1/folder2

    link to
    test.com/main/foler1/folder2/ (Include the slash!)

    Redirection will successfully redirect to
    index.php?dir=/main/folder1/folder2/

    while
    test.com/main/foler1/folder2/
    stays in the url bar.

    It’s a somewhat hackish solution but it should work just fine.

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

Sidebar

Related Questions

Here my .htaccess Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_URI} \/([0-9a-zA-Z]+)$ [NC] RewriteRule ^(.*) image.php?names[]=%1
Here is my .htaccess file Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteRule subpage\?sid /index.php
Here goes my .htaccess file's content. Options +FollowSymLinks RewriteEngine On RewriteRule ^online-products$ products.php?type=online RewriteRule
Here is my .htaccess file: Options +FollowSymlinks RewriteEngine on Rewritecond %{http_host} ^mysite.com [nc] Rewriterule
What is wrong with this line Options +FollowSymLinks RewriteEngine On RewriteRule ^([^/]*)$ /index.php?query=$1 [L]
Here is the code I have currently in my .htaccess file: Options +FollowSymLinks RewriteEngine
Here's the mod_rewrite portion of my .htaccess Options +FollowSymlinks Options -Indexes # Prevent Direct
Here's what my htaccess looks like: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www.site.com$ [NC]
I'm writing a mod_rewrite script. Here's my .htaccess file thus far: RewriteEngine On Options
I tried to enable htaccess. I changed: <Directory /var/www/abc.biz/> Options Indexes FollowSymLinks MultiViews AllowOverride

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.