Viewing 3 replies - 1 through 3 (of 3 total)
  • 1: You can do this with a RewriteRule. Be careful on three fronts.

    First, they are executed in the order they appear in the .htaccess file (top down). Second, RewriteRules take precedence over any Redirects (and RedirectMatches) if you have them. Finally, the regular expressions can get complex pretty easily.

    To rewrite this particular post, as well as any in the same format, it’s fairly simple:

    RewriteRule ^/(.*)/$ /$1.aspx [L,R=301]

    You’re taking anything inside the slashes, then referencing it with the $1 backreference, and appending the .aspx. That’s actually straightforward – however I’m not sure I would do it that way, as it’s going to rewrite everything in your domain that starts with a slash and ends with a slash. If that’s okay, go to it.

    If not, you’re going to need to get more creative – such as doing some rewrites prior to this for other items. But this should take care of you otherwise.

    Now keep in mind – the URL actually ends with “index.php” (you just don’t see it). So you may want to do this in addition to/in place of that one:

    RewriteRule ^/(.*)/index\.php$ /$1.aspx [L,R=301]

    This means “any request for something ending in index.php”. We’re going to throw it out, because we don’t care – we’re using that for the filename – but it’s needed in the request portion of the rule.

    2: If you put them in the same location, so they will have the same URL, then you don’t need to do anything. If they will have a different URL, then you’ll need to create some rewrite rules to get to them. That could be difficult – depending on how many you need to write – or it could be easy – if you can do it with just one (like above). It just depends. The good news is you probably won’t be changing file names and extensions, but directories. So it shouldn’t be too bad.

    This may help learning about mod_rewrite.

    3: I’m sorry, but I don’t understand the question.

    Thread Starter maddyacca

    (@maddyacca)

    3: I mean that how can i migrate all of my images to the new .asp web? my current images path is like this: https://techzend.com/wp-content/uploads/2014/05/Start-a-wordpress-blog.png but how can i manage them on the other server? I am really confused about it…

    This is really a part of #2. Using an FTP client, you would need to download each of the images and then upload it to the new server.

    If you put them in the same location – so that the file name will be the same – then you won’t have to do any mapping/rewriting at all. If you change the file location (and/or name), then you will have to create rules for the images as well, so make sure you keep good records of which files you move, and where you move them to!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Migrating from WP to ASP Website…’ is closed to new replies.