Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Need Help with .htaccess and PHP

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #25532
    Example
    Participant

    Hi,

    Necessary Knowledge

    My .htaccess file redirects like this:
    domain.com/about to domain.com/index.php?page=about

    Code:
    RewriteRule ^([^/.]+)/?$ index.php?page=$1 [L]

    The "page" variable is used in a php include:

    Code:

    The "contents" folder simply contains .html files that are included as the content

    Okay here’s the problem:

    I have a "subfolder" in the "contents" folder with additional .html files that I need to access
    Now I’m trying to redirect like this:
    domain.com/subfolder/about to domain.com/index.php?page=subfolder/about

    This works:

    Code:
    RewriteRule ^([^/.]+/[^/.]+)/?$ index.php?page=$1

    But now I can’t access the subfolder from: domain.com/subfolder/ because there is a ‘page’ variable

    Code:

    Any thoughts, ideas, or help would be greatly appreciated.

    Thanks in advance

    #61284
    Example
    Participant
    "ikthius" wrote:

    Great little resource, but it didn’t have RewriteRule’s. It only had Redirect and I’d like to not have to write a Redirect for each url.

    Thanks for the tip

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.