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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:18:30+00:00 2026-06-07T21:18:30+00:00

I have been doing some URL rewriting for a customer in a test environment

  • 0

I have been doing some URL rewriting for a customer in a test environment that work fine in my environment but when I move to theirs I get different results and the rule fails.

I am 301 redirecting legacy dynamic URLs in the following format:

http://www.companyname.com/page.php?pagename=AboutCompany&lang=EN
to
http://www.companyname.com/EN/about-company/

Using the ruleset below this works fine on my ‘Heart Internet’ shared hosting but fails on their ‘Go Daddy’ shared hosting (configs below). On the Go Daddy environment the legacy URL gets redirected to:

http://www.companyname.com/GET/about-company/
instead of
http://www.companyname.com/EN/about-company/

where does the ‘GET’ come? This is a barebones page with no other code influencing these rules.

RewriteCond %{QUERY_STRING} pagename=AboutCompany
RewriteCond %{QUERY_STRING} lang=([^&]+)
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /page.php
RewriteRule ^page.php$ /%1/about-company/? [R=301,L]

RewriteRule ^([A-Za-z]+)/about-company$ page.php?pagename=AboutCompany&lang=$1 [NC,L]
RewriteRule ^([A-Za-z]+)/about-company/$ page.php?pagename=AboutCompany&lang=$1 [NC,L]

The ‘lang’ querystring differs depending on the user language preference (EN or FR or DE etc…)

Test Enviroment:
Windows
IIS7.5
PHP 5.3.6

Customer Enviroment:
Linux
Apache
PHP 5.2

Thanks, M.

  • 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-07T21:18:31+00:00Added an answer on June 7, 2026 at 9:18 pm

    where does the ‘GET’ come? This is a barebones page with no other code influencing these rules.

    In this snippet of your rules, you have a backreference %1 in your RewriteRule. This references the last () match in the previous RewriteCond, which happens to be (GET|HEAD):

    RewriteCond %{QUERY_STRING} lang=([^&]+)
    RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /page.php
    RewriteRule ^page.php$ /%1/about-company/? [R=301,L]
    

    You want to switch those 2 conditions around:

    RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /page.php
    RewriteCond %{QUERY_STRING} lang=([^&]+)
    RewriteRule ^page.php$ /%1/about-company/? [R=301,L]
    

    So that the %1 references ([^&]+)

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

Sidebar

Related Questions

I have been doing some research on test driven development and find it pretty
I have been doing some mobile web app testing and have noticed that the
I have been doing some research for using MSMQ. Following 2 gave me fundamental
I have been doing some x86 programming in Windows with NASM and I have
So I have been doing some research into getting my UTF8 to print correctly.
I love my GUID. However, lately I have been doing some research to understand
Right, bit of a strange question; I have been doing some linq to XML
Sorry, that I have been posting here so often -- I have been doing
I have been doing some Google searches and only getting partial successful on this
After doing some research, the code that I have come up with is this:

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.