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

  • Home
  • SEARCH
  • 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 755017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:04:50+00:00 2026-05-14T15:04:50+00:00

Background: I have a website that has been built with ASP.NET 2.0 and is

  • 0

Background: I have a website that has been built with ASP.NET 2.0 and is on Windows hosting. I now have to rewrite my site in PHP and move it into Linux hosting. I have a lot of incoming links to my site from around the web that point directly into the old .aspx-pages. The site itself is very simple, one dynamic page and five static ones.

I saved the static .aspx pages as .php-pages and rewrote the dynamic page in PHP. The dynamic page is called City.aspx and I have written it in PHP and it is now called City.php.

On my old Windows hosting, I used ASP.NET’s URL mapping for friendly URL. For example, incoming URL request for Laajakaista/Ypaja.aspx was mapped into City.aspx?CityID=981.

My goal:
To redirect all human visitors and search engines looking for the old .aspx pages into the new .php pages.

I am thinking that the easiest way to redirect visitors into new pages will be by making a redirect, where all requests for .aspx-files will be redirected into .php filetypes.

So, if someone asks for MYSITE/City.aspx?CityID=5, they will be taken into MYSITE/City.php?CityID=5 instead.

However, I am having a lot of trouble getting this to work.

So far this is what I have found:

rewriterule ^([.]+)\.aspx$ http://www.example.com/$1.php [R=301,L] 

However, I think this can not handle the parameters after the filetype and I am also not quite sure what to put on front.

To make things a bit more complicated, at my previous site I used friendly URL’s so that I had a huge mapping file with mappings like this:

    <add url="~/Laajakaista/Ypaja.aspx" mappedUrl="~/City.aspx?CityID=981" />
    <add url="~/Laajakaista/Aetsa.aspx" mappedUrl="~/City.aspx?CityID=988" />
    <add url="~/Laajakaista/Ahtari.aspx" mappedUrl="~/City.aspx?CityID=989" />
    <add url="~/Laajakaista/Aanekoski.aspx" mappedUrl="~/City.aspx?CityID=992" />

I tried to make a simple redirect like this:

Redirect 301 Laajakaista/Aanekoski.aspx City.php?CityID=992

but was not able to get it to work. I ended up with an internal server error and a 50k .htaccess-file…

Any help is greatly appreciated.

  • 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-14T15:04:51+00:00Added an answer on May 14, 2026 at 3:04 pm

    Do you really want to do the cityname / ID translation in the htaccess file?

    The usual way would be to match Laajakaista/*.aspx and to pass the place name as a parameter to the PHP script (which would then do the translating into an ID). Wouldn’t that be a better idea?

    If that is an option, you would do something like this:

    rewriterule ^Laajakaista/([.]+)\.aspx$ city.php?cityname=$1 [QSA]
    rewriterule ^([.]+)\.aspx$ $1.php?%{QUERY_STRING} [R=301,QSA]
    

    You can do that with or without a 301 – a 301 will change the URL visible in the browser.

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

Sidebar

Related Questions

I have an element that serves as the banner on my website. This banner
I have been building applications / web apps for some time, and I guess
Some background info: We have several websites running on a 64-bit machine with IIS6
Background: There is a table, events; this table is formatted latin1. Individual columns in
I'm fairly new to this, and don't have anyone else to ask. I'm attempting
A friend of mine had a friend make a website for her, but this
I'm very used to working in WPF, but I have recently started building websites
So I'm attempting to figure out where my cross-compatibility issue is - From what
I was given an assignment to develop a very simple weather app in Android
Can anyone please help me with this. I am new to css styling. I

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.