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 have looked at a few questions on here concerning this topic. But
I've looked at other people's questions on this topic but can't seem to find
I have googled on this topic and I have looked at every answer, but
I've looked at every other question involving this topic, but they are all in
I already looked at this topic , but I need the answer flipped around.
I've looked in various resources regarding this topic, and it seems to me that
I've looked at this but it wasn't too much help. Maybe I didn't read
I've looked at this question: Select first instance only with XPath? But if I
I know there are a bunch of posts on this topic, but I can't
I've looked through the other Stackoverflow questions on this topic and none of the

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.