301 re-directs pointing from old asp CMS to new CMS php pages - redirect

I have an old cms site based on asp which I need to move to an PHP based CMS - I have searched for web.config examples (its running on a windows server). All the examples I find show re-directing html to html (which I can replicate on my server with a web.config file) when I try to re-direct something a bit more complicated the re-direct is ignored and the original page loads. Can someone give me an example of how I would re-direct from say:
http://www.domainname.co.uk/default.asp?contentID=2 to
http://www.samedomainname.co.uk/index.php?page=repair
I guess its just syntax knowledge - I have about half a dozen specific pages that I need to map to new pages and I do not want to lose the traffic !.
Cheers

Related

How do I crawl a website written in JSP (Java Server Pages) using Perl Script?

I have here this website:https://www.connect2nse.com/iislNet/UserFolder.jsp
Firstly i tried using WWW::Mechanize, but it doesn't seem to work. WWW::Mechanize doesn't work with JSP written website. So I researched about how to download a file in a website written in JSP, but can't find a good one. Can anybody help me with this one? Thanks in advance.
As far as the client is concerned, JavaServer Pages is identical to PHP, Perl, or even static HTML files. The result is a page of HTML that can be rendered and displayed, and the source of the data isn't the reason for WWW::Mechanize failing to do what you want
Doesn't work is useless as a problem description, and the issue could be pretty much anything. However, if the HTML is associated with some JavaScript (which is executed on the client system after the page has been retrieved and not on the server) then it may be more or less handicapped because WWW::Mechanize doesn't support JavaScript. For that you will need to use WWW::Mechanize::Firefox or similar, which works by using a real instance of Firefox to render the HTML and execute any JavaScript

Best way to implement three hundred 301 redirects on windows server / .NET

I'm going live with a rebuilt website (on a new, Windows Server 2008 R2 Standard server). I have a spreadsheet containing 300 URLs from the old site which are mapped to the new site URLs. The URLs for each are 'clean' in that they don't have file extensions (no .php, .aspx, .htm etc).
I've read about the URL Rewrite extension for IIS here: http://weblogs.asp.net/scottgu/archive/2010/04/20/tip-trick-fix-common-seo-problems-using-the-url-rewrite-extension.aspx but it seems to me this is just a GUI tool for writing rules to the web.config file.
If I have 300 rules in web.config won't this hamper performance?
It could be tackled with ISAPI_Rewrite too, but I'm not sure what the optimum way to handle this is.
Can anyone give any advice on the best way to implement my 301 redirects in this situation?
Thanks
If you have a large number of exact URL's that you want to redirect to other exact URL's, have a look at the Rewrite Map feature of the URL Rewrite module. It's specifically designed for that purpose and the performance should be OK.
ISAPI_Rewrite 3 or Helicon Ape can help you handle your situation with ease.
They both support plain text map files and Apache-like configuration.
See the example of using mapfiles here.

How to add RESTful type routes in Jekyll

The root of the site http://example.com correctly identifies index.html and renders it. In a similar manner, I want, http://example.com/foo to fetch foo.html present in the root of the directory. The site that uses this functionality is www.zachholman.com. I've seen his code in Github. But still I'm not able to find how it is done. Please help.
This feature is actually available in Jekyll. Just add the following line to your _config.yml:
permalink: pretty
This will enable links to posts and pages without .html extension, e.g.
/about/ instead of /about.html
/YYYY/MM/DD/my-first-post/ instead of YYYY-MM-DD-my-first-post.html
However, you lose the ability to customize permalinks... and the trailing slash is pretty ugly.
Edit: The trailing slash seems to be there by design
It's actually the server that needs adjusting, not jekyll. Be default, jekyll is going to produces files with .html extensions. There may be a way around that, but it's unlikely that you really want to do go that route. Instead, you need to let your web server know that you want those files served when a URL is called with the file's basename (and no extension).
If your site is served via an Apache web server you can enable the "MultiViews" option. In most cases, you can do that be creating an .htaccess file at your site root with the following line:
Options +MultiViews
With this option enabled, when Apache receives a request for:
http://example.com/foo
It will serve the file:
/foo.html
Note that the Apache server must be setup to allow the option to be set in the htaccess file. If not, you would need to do it in the Apache config file itself. If your site is hosted on another web server, you'll need to look for an equivalent setting.

htaccess vs hard coded

When creating a CMS which would you recommend?
Making a htaccess dynamically create the pages based on ?pg=name
or
Making a FTP connection to auto create each file on the fly? This means when a new page is created/edited/deleted the admin, when saved, would ftp into the site and create the page.
Pros and Cons
"Pro" Less files means less space
"Con" More continually overhead for apache to redirect
"Con" More space taken
"Pro" Less work to find file sense its created and only once loaded when changed
ALright, let me clarify. Which is the better option.
create index.php and have all htaccess redirect to it sending ?pg=name and then get the content from database
have an admin automatically ftp into a site when content is created/edited/delete and create the page so when the person types the page in its hard coded
Without a doubt the best way to go for your CMS is using Apache mod_rewrite. This way you have more flexibility in the future for changing the way that you want URLs displayed, and it expedites the creation of new content so that it doesn't have to be uploaded via FTP every time.
If you have to use FTP to use your CMS, I'm afraid it won't be very scalable, which is one of the benefits of a CMS.
Your 'better option' is 1. Stick to mod_rewrite.
If you want to, you can mix those options - use htaccess for nice names for your pages, rewriting them to ?pg=name and then load data from file or database.

Web CMS That Outputs to Flat Static Pages (.html) via FTP to Remote Server?

I have a web app project that I will be starting to work on shortly. One of the features included is going to be a content management system where users can add content and then that content will be combined with a template and then output as a regular .html file. This .html file would then be FTPed to their own web host.
As I've always believed in not reinventing the wheel I figured I'd see if there are any quality customizable CMSes out there that do this already do this. For instance, Blogger.com allows you to post all of your content to your account there; but offers the option to let you use your own hosting. Any time you publish a new article then a new .html page is generated (as well as an updated index page with links to the new article) and then the updated content is FTPed to your own server.
What I would like is something like this that I can modify to more closely suit my needs.
Required Features:
Able to host on my own server
Written in PHP
Users add content through their account, then when posted it is FTPed as .html to their server
Any appropriate pages are also updated to link to the new content (like the index page or whatnot)
Templateable
Customizable
Optional (but very much desired) features:
Written in CodeIgniter or a similar PHP framework
While CodeIgniter isn't strictly required, I would very much prefer it. It speeds up development time and makes things much easier to implement.
So - any suggestions? I've stumbled across a few CMSes that push to remote servers as static pages, but the ones I've found all are hosted on the developers servers which means that I cannot modify it at all.
Adobe Contribute might work for your situation. A developer/designer creates a set of templates with Dreamweaver and publishes the templates. Authorized users can then create pages based on the templates and only make changes within the editable regions. It includes systems for drafts and reviews prior to publishing (via many options, including ftp) and incorporates automatic version control. It can work with static html pages or dynamic pages like php.
Sounds like you need a separate application that can do this for you.
For example, you should be able to write something that queries Drupal's menu router and saves the output (with curl) to a directory and then run's rsync to push your content where you want it to go.
Otherwise your requirements are likely to be outside the scope of a typical CMS. Separating this functionality will give you better options.
You'd need to write a filter for your URLs too. It's a bit of work...
Hope that helps!