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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:02:24+00:00 2026-05-18T02:02:24+00:00

I looked at this topic: configuring search engine friendly url (mod_rewrite) and understand how

  • 0

I looked at this topic: configuring search engine friendly url (mod_rewrite) and understand how the rewrite rules would apply, but need help understanding how to adopt them for websites that have static and dynamic URL’s.

From the topic above, the rewrite rules would first look for a file that existed in the URL, and deliver it. So that would cover my static pages.

Question 1: would indexing be preserved (in other words, domain.com/foo would show domain.com/foo/index.php)?

Question 2: is there a way to use a single template file with these static pages (so the static file is really only the content)? At the moment, my rewrite rules point all URL’s to a main template file that looks for the requested file and then includes it.

Moving on, the rewrite rules would redirect you to index.php for any URL’s that didn’t match the above rule. I assume that’s where I’d want my code to determine if it’s an actual URL for my site, and deliver the content accordingly.

Question 3: redirecting to index.php isn’t going to pass along any variables to process. If I used index.php?url=$1 would that account for both domain.com/hi and domain.com/hi/there?

Question 4: what steps can I take to ensure the URL’s processed are legitimate (and not xss attacks or anything like that)? Should I set up a separate table in my MySQL database that stores all the possible URL’s along with the ID of the content? I assume that’s how WordPress works. Or, if not using MySQL, would I do this with a class, or array?

I know it’s a lot, thanks in advance for everyone’s help!

  • 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-18T02:02:24+00:00Added an answer on May 18, 2026 at 2:02 am

    Just for the record: If not mentioned otherwise, all following answers refer to these rules that were mentioned in jiewmeng’s configuring search engine friendly url (mod_rewrite):

    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    

    Question 1: would indexing be preserved (in other words, domain.com/foo would show domain.com/foo/index.php)?

    If you refer to index documents specified by DirectoryIndex, then, yes, as REQUEST_FILENAME would refer to an existing directory, the comparator -f would yield true and no rewrite would take place.

    Question 2: is there a way to use a single template file with these static pages (so the static file is really only the content)? At the moment, my rewrite rules point all URL’s to a main template file that looks for the requested file and then includes it.

    No, that is not possible. Static files that are not further processed by a handler are directly sent to the client.

    Question 3: redirecting to index.php isn’t going to pass along any variables to process. If I used index.php?url=$1 would that account for both domain.com/hi and domain.com/hi/there?

    In the mentioned example you can use $_SERVER['REQUEST_URI'] to get the original requested URI path and query string as it appeared in the request line. So even the original requested query string will be preserved.

    Question 4: what steps can I take to ensure the URL’s processed are legitimate (and not xss attacks or anything like that)? Should I set up a separate table in my MySQL database that stores all the possible URL’s along with the ID of the content? I assume that’s how WordPress works. Or, if not using MySQL, would I do this with a class, or array?

    Yes, you should definitely know what URLs are valid and what are invalid. And in general it’s the application that does this decision by parsing the request and trying to find the requested resource. How that is done depends on what your application does and how it does that.

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

Sidebar

Related Questions

ok, I know that this topic has been addressed several times on here, but
I work with a lot of floating-point images, and would find it extremely useful
I'm going over this in my theory class, and I'm curious as to how
I am trying to draw and animate with SWT using PaintListeners . I would
I'm a bit confused about how to commit on several svn branches from different
I need a methodology to organize my team for a university assignment. I am
I want to track a variety of properties relating to a row in a
I have the following: MainApp - Assembly 1 (Contains UserContolA) - Assembly 2 (Contains
During an operation (rspec related) that required loading rubygems (from config/boot.rb file) I got

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.