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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:33:30+00:00 2026-06-01T20:33:30+00:00

I am using ISAPI rewrite on a project and would like to know if

  • 0

I am using ISAPI rewrite on a project and would like to know if it is possible to publish a .htaccess file from Tridion?

I have tried creating a Page Template with the .htaccess extension but can’t create a page with no name.

Any ideas?

Could I use a C# TBB to change the page name?

  • 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-01T20:33:31+00:00Added an answer on June 1, 2026 at 8:33 pm

    I would also choose to use a binary to achieve this, but if you want to manage the htaccess file using text, rather than as a multimedia component, you can push a binary into your package using the following technique:

    1) Push the text of the Htaccess file into the package with an accessible name (i.e. Binary_Text)
    2) Use code similar to the following to create a text file from the text in the variable and add it to the package

    class publishStringItemAsBinary : ITemplate
    {
        public void Transform(Engine engine, Package package)
        {
            TemplatingLogger log = TemplatingLogger.GetLogger(typeof(publishStringItemAsBinary));
            TemplateUtilities utils = new TemplateUtilities();
            System.IO.Stream inputStream = null;
            try
            {
                string strInputName = package.GetValue("InputItem");
                string strFileName = package.GetValue("strFileName");
                string sg_Destination = package.GetValue("sg_Destination");
                string itemComponent = package.GetValue("mm_Component");
    
                inputStream = new MemoryStream(Encoding.UTF8.GetBytes(package.GetValue(strInputName)));
    
                log.Debug("InputObject:" + strInputName);
                log.Debug("Filename for binary:" + strFileName);
                log.Debug("Destination StructureGroup:" + sg_Destination);
                Publication contextPub = utils.getPublicationFromContext(package, engine);
                TcmUri uriLocalSG = TemplateUtilities.getLocalUri(new TcmUri(contextPub.Id), new TcmUri(sg_Destination));
                TcmUri uriLocalMMComp = TemplateUtilities.getLocalUri(new TcmUri(contextPub.Id), new TcmUri(itemComponent));
                StructureGroup sg = (StructureGroup)engine.GetObject(uriLocalSG);
                Component comp = (Component)engine.GetObject(uriLocalMMComp);
                String sBinaryPath = engine.PublishingContext.RenderedItem.AddBinary(inputStream, strFileName, sg, "nav", comp, "text/xml").Url;
                //Put a copy of the path in the package in case you need it
                package.PushItem("BinaryPath", package.CreateStringItem(ContentType.Html, sBinaryPath));
            }
            catch (Exception e)
            {
                log.Error(e.Message);
            }
            finally
            {
                if (inputStream != null)
                {
                    inputStream.Close();
                }
    
            }
        }
    }
    

    I think the code is pretty self explanatory. This publishes a binary of type text/xml, but there should be no issue converting it to do a plain text file.

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

Sidebar

Related Questions

I'm using Helicon's ISAPI Rewrite 3 , which basically enables .htaccess in IIS. I
I'm using Isapi Rewrite 3 (mod rewrite clone for IIS) and trying to rewrite
I am using IIRF - an ISAPI rewrite filter for pretty URL's. I haven't
I want to implement an ISAPI filter like feature using HttpModule in IIS7 running
I have an ISAPI filter that I am using to do URL rewriting for
I'm currently using ISAPI Rewrite I'd interesting in moving my ColdFusion app to Apache
I have an htaccess file which begins with the regular stuff: RewriteEngine on RewriteBase
I have a simple rewrite rule that writes to an external domain using the
We have a Delphi COM component being called from an ISAPI web app. The
I am using ionics isapi rewrite filter to redirect all .asp files to validate.asp

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.