Forum Moderators: open
I am dealing with an issue I would need assistance with. I have been programming in PHP for several years, learnt to implement URL rewriting through the htaccess file, etc...
I am working on a project, ASP related, which I am not that familiar with...unfortunately.
The site has thousands of pages, category, supplier, product pages, and they currently use some URL rewriting (Aspi i believe). Well, we have some issues the way the URLs are structured and would like to introduce a new format. In order to do that, we'll need to 301 redirect all the old URLs to the new format, and I am not sure how to proceed in ASP.
I believe the htaccess file is unique to Apache, so which file do you modify for URL rewriting with ASP?
Also, would you guys mind looking at the URL format and give me your feedback on the proper URL rewrite commands to do the 301 redirects across the site? Any good resource I could refer to as well?
Thanks! Bobosse
Here are some basic examples...
Redirect Primary Domain to Sub-Domain
RewriteCond Host: ^example\.com
RewriteRule (.*) http\://www\.example\.com$1 [I,RP] Redirect Old Page to New Page
RewriteRule /old-file.asp http://www.example.com/new-file.asp [I,O,RP,L] If you are familiar with regular expressions on Apache, I do believe working with the rewrite routine (httpd.ini) for IIS is basically the same.
Others with more technical experience in this area will most likely chime in.
I guess the main issue I have is the following.
We want to modify the current URL format they use and introduce a "tree" format, kind of more logical than what they use.
Current URLs are like that:
[mydomain.com...]
The 1000 is the category ID.
What we want to do is:
[mydomain.com...]
But, the problem is that the category name is not is the URL currently, so it ain't easy.
What would be the best to do that? I mean writing the URL rewriting the asp pages to htm pages should not be too difficult, but what about setting up 301 permanent redirects without having the category name...
Any tricks you guys could think of?
B.
if (Request.Url.AbsoluteUri.ToLower().StartsWith("http://old"))
{
Response.StatusCode = 301;
Response.StatusDescription = "Moved Permanently";
Response.RedirectLocation = "http://new";
Response.End();
}