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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:50:38+00:00 2026-05-18T04:50:38+00:00

I have the following problem. We used many different URLs to the same page.

  • 0

I have the following problem. We used many different URLs to the same page. Now we want to use only one URL for those pages. Here an example:

RewriteRule ^(subfolder1/folder1/|(subfolder2|subfolder3)/folder2/|folder3/)?(name1|name2|name3|name4)$ scriptname.php [QSA,NC]

As you can see it is pretty messy. What I now want to do is the following: Rewrite all URLs to only one of those URLs (e.g. subfolder1/folder1/name1) using a 301 and than using a rewrite on that URL to address the actual script. It might look like this:

RewriteRule ^((subfolder2|subfolder3)/folder2/|folder3/)?(name2|name3|name4)$ /subfolder1/folder1/name1 [R=301,QSA,NC]
RewriteRule ^subfolder1/folder1/name1$ script.php [QSA.NC]

Until here I have no problem. But now comes the tricky part. We use several development machines on UNIX and Windows machines. They all have different host names and folder. Here are some examples:

http://www.example.com (production)
http://test.example.com (testing)
http://localhost/development_folder/ (development WIN)
http://localhost:8888/development_folder/ (development MAC)

The issue is, that as we have subfolders on the development machines, I can’t use an absolute URL as /subfolder1/folder1/name1/ as it would e.g. point to http://localhost/subfolder1/folder1/name1/ and not to http://localhost/development_folder/subfolder1/folder1/name1/ so all the rewrites would be broken on the development machines.

Is there any chance to get this issue working? As the folder development_folderis the same on all development machines, would it help to exclude/include that folder to the rewrites afterwards like this:

RewriteRule ^((subfolder2|subfolder3)/folder2/|folder3/)?(name2|name3|name4)$ /development_folder/subfolder1/folder1/name1 [R=301,QSA,NC]
RewriteRule ^development_folder/(.*)$ $1 [QSA.NC]
RewriteRule ^subfolder1/folder1/name1$ script.php [QSA.NC]

Or is there a better way of doing it? Any hint would help a lot.

  • 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-18T04:50:39+00:00Added an answer on May 18, 2026 at 4:50 am

    I would use Apache Include directives to modify the rule set. That way I can test the rules that will be used in production.

    I don’t remember if there is an issue with resolving the include wildcard to include no files, but if there is you could use an empty file in production and the actual dev rewrite rules one in dev.

    RewriteRule ^((subfolder2|subfolder3)/folder2/|folder3/)?(name2|name3|name4)$ /subfolder1/folder1/name1 [R=301,QSA,NC]
    Include /etc/apache/conf.d/*_dev.rewrites
    RewriteRule ^subfolder1/folder1/name1$ script.php [QSA.NC]
    

    On you dev machines and ONLY on your dev machine have the /etc/apache/conf.d/my_dev.rewrites:

    RewriteRule ^development_folder/(.*)$ $1 [QSA.NC]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am really struggling on this one; I have read many different posts and
Problem I want ot write a simple 1D RTS game and have the following
I have following problem: I have built a tabbar application with 4 tabs. I
I have following problem, Code: String a=Yeahh, I have no a idea what's happening
I have the following problem: I have a form in site/banen (currently local running
I have the following problem. I have three classes, A, B and C. A
I have the following problem: I implemented a managed mobile application for Windows Mobile
I have the following problem that the standard library doesn't solve well, and I'm
I have the following problem: I got a view with two text fields and
I have the following problem in a Database using Access 2007 as front end

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.