Basic URL ReWrite

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 3
Joined: 17 May 2012, 17:26

Basic URL ReWrite

17 May 2012, 17:33

Hey,

I have been attempting to do a URL ReWrite for a few days now and am not having much success. I have 161 URLs that either need to be Search Engine Friendly or 301 redirected, but I am just focusing on the ReWrites right now.


Current URL: http://mysite.com/special-needs/easy-to ... -in-gravy/

New URL: http://mysite.com/dog-food/easy-digesti ... uts-recipe


My Code:


RewriteEngine on
Rewritebase /

Rewriterule ^special-needs/easy-to-digest/lamb-rice-and-barley-cuts-in-gravy/$ dog-food/easy-digestion/lamb-rice-barley-cuts-recipe [NC,R=301,L]



All this does at this time is redirect me to the new URL it does not display the page. What am I missing?

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Basic URL ReWrite

18 May 2012, 07:06

And now you do the opposite to let server know where to take data from for this new URL:

Code: Select all
Rewriterule ^dog-food/easy-digestion/lamb-rice-barley-cuts-recipe$ special-needs/easy-to-digest/lamb-rice-and-barley-cuts-in-gravy/ [NC,L]


Simply add this rule to an existing.

Regards
Andrew

User avatar
Posts: 3
Joined: 17 May 2012, 17:26

Re: Basic URL ReWrite

23 May 2012, 11:57

Thanks for the fast response it has worked great for my needs.

My next task has been to redirect some dead links that appear in Search Engines to the homepage of my site.

I haven't been able to accomplish this as I think my rules will not allow me to direct the user to a file in the root directory.


Dead Link: Example.com/siteloader.swf
Homepage: Example.com/default.htm

The below has worked on other pages to direct them correctly, but I cannot direct any files to a file in the root directory.


RewriteEngine on
Rewritebase /

Rewriterule ^dog_easy_to_digest\.aspx$ special-needs/easy-to-digest/fish-meal-and-potato/ [NC,R=301,L]

User avatar
Posts: 3
Joined: 17 May 2012, 17:26

Re: Basic URL ReWrite

23 May 2012, 17:07

I was able to work this out after searching the forums here for a second day. The code is as follows for anyone with a similar problem.



RewriteEngine on
Rewritebase /

RewriteRule ^siteloader\.swf$ / [NC,R=301,L]

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 5 guests