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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:38:58+00:00 2026-05-31T12:38:58+00:00

I’m in trouble with this .htaccess RewriteCond %{HTTP_HOST} appname.domain.com RewriteCond %{REQUEST_URI} !appname/ RewriteRule ^(.*)$

  • 0

I’m in trouble with this .htaccess

RewriteCond %{HTTP_HOST} appname.domain.com
RewriteCond %{REQUEST_URI} !appname/
RewriteRule ^(.*)$ /appname/$1 [L]

In the document root (not really the root document, let’s say a v-domain folder) i have this folder called ‘appname’. On appname.domain.com everything shows up fine as it should. Now my problem is when I want to do something like this

http://appname.domain.com/somefolder

I don’t want the url to be rewritten to
appname.domain.com/appname/somefolder
In the url bar.
Any help?

Update:
In the document root i have

RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^v-domain/
RewriteRule ^(.*)$  /v-domain/$1 [L]

In v-domain

RewriteEngine On
RewriteBase /v-domain/

RewriteCond %{HTTP_HOST} appname.domain.com
RewriteCond %{REQUEST_URI} !appname/
RewriteRule ^(.*)$ /appname/$1 [L]
RewriteCond %{HTTP_HOST} appname.domain.com
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^appname/(.+)$ http://appname.domain.com/$1/    [R=301,L]
###################
RewriteCond %{HTTP_HOST} appname2.domain.com
RewriteCond %{REQUEST_URI} !appname2/
RewriteRule ^(.*)$ /appname2/$1 [L]
RewriteCond %{HTTP_HOST} appname2.domain.com
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^appname2/(.+)$ http://appname2.domain.com/$1/  [R=301,L]
  • 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-31T12:38:59+00:00Added an answer on May 31, 2026 at 12:38 pm

    Try to make a dir in your subdomain folder with an index in it and then try to reach that path. You will see the url being rewritten in the ugly mentioned way “appname.domain.com/appname/somefolder”

    That sounds like it’s mod_dir’s DirectorySlash interferring. With DirectorySlash turned on, if mod_dir sees that a request is made for a directory and is missing the trailing slash, it redirects the browser to the equivalent URL to include the trailing slash.

    Something you can do is to turn DirectorySlash off but there’s a disclosure concern when it comes to DirectoryIndex’ing (see the DirectorySlash entry in mod_dir). You could try adding some rules to do this redirect for you but make sure to redirect without the /appname/ bit in the URL:

    RewriteCond %{HTTP_HOST} appname.domain.com
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{REQUEST_URI} !/$
    RewriteRule ^appname/(.+)$ http://appname.domain.com/$1/    [R=301,L]
    

    This basically checks if the request is for the host appname.domain.com, that the requested entity is a directory, that the request does not end with a trailing slash, and if the request has already been rewritten for /appname/ redirect the browser to the same URL (without appname) but with a trailing slash. After the redirect, the first rule that you have will internally rewrite the URI to include the /appname/, but since the request now ends with a trailing slash, mod_dir should ignore it.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT

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.