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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:33:34+00:00 2026-05-28T19:33:34+00:00

I have a structure called /pdf/ where generated PDFs are stored. I am trying

  • 0

I have a structure called /pdf/ where generated PDFs are stored. I am trying to use .htaccess to route visitors to the PDF folder.

I have this rule in my .htaccess file:

RewriteEngine On
RewriteBase /
RewriteRule (.*) index.php?page=$1.html
RewriteRule ??? for pdf??

(Note the ??? marks…)

When I try to access the url /manual_chap_1 it is working. But when I try /pdf/manual_chap_1 it doesn’t seem to be working. Here is some output I see:

$_GET[page] => index.php.html

I want to be able to generate the PDF file, if the PDF file does not exist in the requested location, and then, I want it to load an HTML page.

  • 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-28T19:33:36+00:00Added an answer on May 28, 2026 at 7:33 pm

    Try this:

    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^pdf/([a-z0-9\-_\.]+)$ pdf.php?file=$1 [L,NC,QSA]
    
    RewriteCond %{REQUEST_URI} !^/pdf
    RewriteRule ^([a-z0-9\-_\.]+)/?$ index.php?page=$1.html [L,NC,QSA]
    

    L: The [L] flag causes mod_rewrite to stop processing the rule set. In most contexts, this means that if the rule matches, no further rules will be processed. This corresponds to the last command in Perl, or the break command in C. Use this flag to indicate that the current rule should be applied immediately without considering further rules.

    QSA : When the replacement URI contains a query string, the default behavior of RewriteRule is to discard the existing query string, and replace it with the newly generated one. Using the [QSA] flag causes the query strings to be combined.

    NC: Use of the [NC] flag causes the RewriteRule to be matched in a case-insensitive manner. That is, it doesn’t care whether letters appear as upper-case or lower-case in the matched URI.

    Also, I would recommend to use dashes instead of underscore.

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

Sidebar

Related Questions

I have a data structure like this: struct foo { int id; int route;
So I have a django project I just created called 'coolprojectsite' the directory structure
I have a structure like this: <ul> <li>text1</li> <li>text2</li> <li>text3</li> </ul> How do I
I have a structure like this.... UITableViewController -> UITableViewCell -> UIView I need the
I have a php file that needs to be called directly. It renders PDF
I have a structure called Patch that represents a 2D array of data. newtype
I have a structure called log that has 13 chars in it. after doing
i have structure like this <table><tr><td></td><td><input type=button name=button></td></tr></table> <script> $('tr').click(function(){window.alert('tr');}) $(':input').click(function(){window.alert('input');}) </script> when i
I've been trying to include a structure called student in a student.h file, but
I have a structure called table, I just want to create a table, like

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.