Custom Error Page Redirects?
-
Hello,
I am fairly new here. I am just migrating to the WP platform. In order to provide valid links for everyone after the migration I need a way to handle users visiting a post using the “wrong”, that is, old URL. Say, the user types an old URL such as “http://www.somedomain.com/A+Title.aspx” and I want him to get to the new URL “http://www.somedomain.com/yyyy/mm/dd/A-Title/”. I figured I would use some JavaScript in my CSS each time a “Not Found” page is presented, parse the window.location and redirect to the correct page.
Has anyone done this before? are there any known issues with such an approach?Any feedback is greatly appreciated.
Bests,
Ben -
Are you using a blog hosted on wordpress.com? If so, we can’t use javascript here. If you’re hosted somewhere else and using the WordPress software, you’ll want to ask about this in the wordpress.org forums.
If your host uses Apache and you have access to mod-rewrite, you’ll be better off with that as a solution. It will work even if the user doesn’t have javascript enabled.
-
Yes, I am hosting on wordpress.com with the domain and the CSS upgrade. This should allow me to use JavaScript, right? I was at least able to include some Google Analytics JavaScript just minutes ago…
-
If you did include JavaScript succesfully, you found a severe security hole. It’s not supposed ti happen by WordPress.com
-
Well, I don’t know if it is executed, but if you care to visit: http://shamiro.ch/ and look at the html source you will rightly see the Google analytics JS. Maybe this is the ONLY JS being allowed?
-
All right, my bad, it is Google Analytics code, but not using my ID. My bad, sorry for this. So, there is no JS… hmm
-
Since you mentioned an aspx page, I’m assuming that the domain you’re concerned with does not end in wordpress.com. Do you have a host available that runs Apache and gives you access to mod-rewrite? If so, there may still be a trick that will accomplish what you’re looking for, but it would require some testing…
-
@singularcintiguity
Thanks for your suggestion.
I am moving from my own servers to WP. I intend to retire these servers. But I could certainly find an server instance to run an Apache with mod-rewrite. But… How do I differentiate which page request goes where?
Currently all of the request to my domain are handled by ns*.wordpress.com. Once a user gets there with the wrong URL, how do I get him to any Apache instance?
Or are you suggesting to direct all name server entries to an Apache instance and redirect appropriately to WP from there? -
Or are you suggesting to direct all name server entries to an Apache instance and redirect appropriately to WP from there?
This would be the one I was thinking of. It would be tricky to set up, but the Retrieve Missing Data from Intranet example at http://httpd.apache.org/docs/2.2/rewrite/rewrite_guide_advanced.html might get you what you’re looking for. It should let you get your hands on anything that comes in to your domain name, without interfering with the operation of wordpress.
The only real downside is that I can’t see at the moment how to get a single canonical URL for each post unless you’re willing to change the blog address to something like
subdomain.somedomain.com
for your wordpress address, and do a final external rewrite to that...
- The topic ‘Custom Error Page Redirects?’ is closed to new replies.