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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:29:58+00:00 2026-05-20T14:29:58+00:00

I want to create a rule for one subdomain which redirects to a file

  • 0

I want to create a rule for one subdomain which redirects to a file on the root-directory. If the rules don’t match the user should be redirected to the original domain.

Both, the subdomain and the domain link to the same directory. But if the first subdir of the given REQUEST_URI matches a filename in the directory, my rules seem not to match the REQUEST_URI.

Information:

  • http://sub.domain.tld –> root-directory
  • http://domain.tld –> root-directory
  • File test.php exists in root-directory with content: print_r($_SERVER[‘QUERY_STRING’]);
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^sub\. [NC]
RewriteCond %{REQUEST_URI} ^/([a-z]+)/ [NC]
RewriteRule ^test/ http://domain.tld/ [L,R=301]
RewriteRule ^([a-z]+)/(.*)$ test.php?dir=$1&data=$2 [L]

With http://sub.domain.tld/xyz/something the test.php outputs “dir=xyz&data=something”.

But if I use http://sub.domain.tld/test/something I get only a blank page. But this should also output “dir=test&data=something”.

What is my mistake? Is it also possible to optimize my rules?

  • 1 1 Answer
  • 1 View
  • 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-20T14:29:59+00:00Added an answer on May 20, 2026 at 2:29 pm

    Got it! I had to deactivate MultiView which was activated by default. MultiView is useful to call files without extension. Therefor http://domain.tld/file is rewritten to file.EXT (with which extension the file is stored on the server).

    My server modified the REQUEST_URI to /file.EXT/subdir/subfile.html if I called a file which was stored on the server.

    Example: test.php is a valid file. http://domain.tld/test/something –> request_uri: /test.php/something

    Add to your htaccess-file:

    Options -MultiViews
    

    to deactivate it and get it working!

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

Sidebar

Related Questions

I want create wordpress website into which I want create user management... That means
Example: I want to create one AutoResponse rule that will map all calls to
I want create module which update list of usb devices automatically (not only mass
I was wondering if there is a way through which one can create unique
The one class per file rule in Java has me a bit confused. I
Let's say I want to support urls like twitter where: twitter.com/username redirects to twitter.com/user_name.php?user=username
i want create multiple search where statement $where_search is a multiple condition from post
i want create a custom json data from the mssql 2008 results so that
I want create an application with animate button? how can i do? after click
i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =

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.