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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:33:20+00:00 2026-06-14T02:33:20+00:00

I couldn’t do it any shorter :-/ I’m having a problem with my php

  • 0

I couldn’t do it any shorter :-/

I’m having a problem with my php project concerning redirects and $_GET.

I hope you will help me 🙂

Lets say I have these 3 folders in the root of my Webserver.

/root
   /themes
         /page.php
   /project1
         /index.php
         /content.php
   /project2
         /index.php
         /content.php

/themes contains a php file called /page.php
/page.php contains a dynamic PHP/HTML structure or theme, which I can use for different content files.

/project1 and /project2 contain mostly HTML content files which get included by /page.php.

/project1 and /project2 are the root folders for 2 different domains, so each contains an index.php.

Now the problem:
In order to get the websites for each domain to work I have to redirect the user to /themes/page.php, because thats where the functionality is and then include the correct content files.
To let /page.php know what content file out of /project1 or /project2 it has to load I use a redirect for index.php to fill $_GET ,like this :

header("Location: root-domain/themes/page.php?path=project1&file=content1");

That way page.php gets to know the path and filename of the requested file, by taking it from GET.

BUT:
That way the user gets to know each folder and each filename, even of some php files. I don’t know if that’s good?
And the URL changes from the requested URL into the URL of my webserver root.

Does one know a better solution?

Thanks! <3

  • 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-14T02:33:21+00:00Added an answer on June 14, 2026 at 2:33 am

    Actually, I think there is a solution, you just need to use mod_rewrite, which is a module for Apache. With that, you could redirect all your URL requests to this one specific page of yours. Unfortunatelly, the "magic" behind mod_rewrite is little bit more complex, so I recommend you this documentation for further uses.

    But for now, just check if you have a mod_rewrite turned on in server configuration, then simply create a file called .htaccess in directory project1 (or any other) and insert this little piece of code in it:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^([^/.]+)/?([^/.]+)?/?$ /themes/page.php?path=$1&file=$2 [QSA]
    </IfModule>
    

    Hit save, and that should be it. Now every page request goes through /themes/page.php.

    And by the way, you definitely shouldn’t be exposing script names in url.

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

Sidebar

Related Questions

Couldn't find any answer to this problem, or not even any questions asked. So
couldn't find my solution. hope you can help. I want to have a url
Couldn't comment on this post, which states the problem I'm experiencing: jQuery remove() on
I couldn't find any information in the reference page of MPMoviePlayerController or in the
Couldn't find a better place to ask this so I hope you guys can
I couldn't find any mapview template for the graphical layout. Mapview is from google,
i couldn't send data from my device to my php file. i am trying
Couldn't find anything relevant in forums So ,Please help me with this code .I'm
Couldn't the diamond problem be resolved just by using the first inherited declaration found?
Couldn't find any file-tree component (cross-platform, of course) in the FireMonkey framework. Anyone has

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.