Help With 301 Redirection on Plesk Servers (eUk Host Specifically) - seo

I am running around in circles here, I wonder if anyone can help.
I recently moved a static html website to Umbraco. It is running on a Windows plesk shared plan.
I need to put in place 301 redirects for the old content to the new but:
Umbraco won't receive requests for.html, there doesn't appear to be a way to do this.
I can't get any server side running in the .html files that the plesk supports as custom error docs.
I was going to use client side meta redirects, but wasn't sure if Google etc will read these right?

I haven't used it myself, but the Umbraco 301 Moved Permanently project looks like it does what you need.
The real trick will be piping all requests for .html files through ASP.Net. I'm not sure if this can be done with your web host. But some tips can be found here:
http://our.umbraco.org/projects/developer-tools/301-moved-permanently/feedback/7271-when-the-old-pages-are-not-from-umbraco
p.s. You are correct that a client-side redirect will not help with SEO.

you could add a rule in to your UrlRewriting.config the file sits here in the Umbraco installation... "~config/UrlRewriting.config"
The rule would strip the .html extension from the page request. And would look something like the following...
<add name="removehtml"
virtualUrl="^~/(.*).html"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/$1"
ignoreCase="true" />
You would also have to make sure that the web.config file had the following key set to true
<add key="umbracoUseDirectoryUrls" value="true"/>
This would allow you to recreate your url structure with nodes inside the umbraco cms without the html or aspx extension. If all this seems too complex you could individually add each page you want to listen for to the corresponding node in the URL Alias property (umbracoUrlAlias). Umbraco will take this and redirect to your page.

Related

HTTP access was forced to visit HTTPS

I have a few web sites that are hosted in a VPS.
Today, I found that when visiting "http://api.rsywx.com", it forces me to visit "https://api.rsywx.com", and the redirects me to "https://rsywx.net" (which is SSL enabled).
I checked my virtual host files, and did not find out anything forcing this redirect.
Anyone can point me some direction on how this can happen?
Redirects can be done on different ways and levels. Most elegant ways in descending order (my opinion):
Apache conf (mostly in /etc/apache2/apache2.conf)
.htaccess - file
in the index.php or the used backend script/code
(- could be even done in the frontend with javascript files but for that the page must be loaded and then will be redirected.. So nothing somebody should use)
Problem solved. I added one line in my Silex application's entry index.php to require HTTPS access, which is meant to be locally tested only.

Apache routing without htaccess

I am working with a custom website built in PHP running on Apache server. The client wants to move it to a new server. I moved everything including the .htaccess file, the homepage loads fine but all the other urls like site.com/register isn't working. I'm sure this is not handled by code in the old server because I renamed everything (including .htaccess) and it still works. If I create a file like test.php in the old server, I can access it like site.com/test. It doesn't even hit the index.php file. Also, not all the urls work like this, some are loading through files in other folders.
So my question is - what are the possible ways that Apache can let user access site.com/test without the .php extension. It must not be using .htaccess. Also, we should be able to add exceptions to this so that some urls can be loaded differently.
you can achieve same thing in hosts file if you are using Linux server. you need to define same rules in hosts configuration file.

htaccess http request re-routing

Reason for Problem:
I'm working on a website and wanted to work on it without making edits to the live website. My hosting package allows for "infinite" domains. So instead of editing the live website I create a new domain, without purchasing the domain name and am trying to develop with this new domain.
Issue At Hand:
This issue is that the reference file paths don't work anymore and return 404 when trying to load the webpage. My original website directory structure looks like this
cgi-bin
config
public_html
->JSfiles
->CSSfiles
->PHPfiles
The new one is the same structure however when you open the "temporary web address" the URL looks like this
http://217.199.187.199/myTempAddress.com/"
instead of
http://myTempAddress.com/
so when my index.html file looks for /JSfiles/someJSfile.js its requesting
http://217.199.187.199/JSfiles/someJSfile.js
when it needs to be requesting
http://217.199.187.199/myTempAddress.com/JSfiles/someJSfile.js
Things I've Tried Unsuccessfully:
I would really like to fix this by redirecting with the .htaccess file in the root directory on the server. Ive tried using the following directives with no success.
Redirect /217.199.187.199/JSfiles/mustache.min.js http://217.199.187.199/myTempAddress.com/JSfiles/mustache.min.js
Redirect /JSfiles http://217.199.187.199/myTempAddress.com/JSfiles/
Redirect /JSfiles http://217.199.187.199/myTempAddress.com/
Redirect /JSfiles 217.199.187.199/myTempAddress.com/
Question:
How can I redirect the requests to the right location? I need all the the requests to be of the form http://217.199.187.199/myTempAddress.com/someDir/Somefile.ex
You need to read up a bit more on Virtual Hosting in particular name based virtual hosting.
https://httpd.apache.org/docs/current/vhosts/name-based.html
It sounds like your provider might support name based VHosts but what you're trying to do is not taking advantage of that. To do what you want ie have path that points to a different version of your site is best achieved using mod_rewrite. See this
https://httpd.apache.org/docs/2.4/rewrite/remapping.html
You need to make sure that your provided actually supports this.

how do i use htaccess to make http requests work properly

I currently have css and javascript file calls (amongst other things) like the following:
href="/css/default.css"
src="/js/ui_control.js"
putting the preceding / in to make the files relative to the root.
This works great when my page is in the root of the domain.
However, I'm currently in the middle of transferring my site to a new hosting provider and as such have a temporary URL which is: HOST-IP/~username
As such, all file calls are trying to be called from HOST-IP/css/default.css etc instead of within the ~username sub-folder.
Of course I can wait until the domain name servers propagate but that's beside the point.
How would I go about writing a rule in the .htaccess file that would redirect all file calls that start with a /, from going to HOST-IP/FILE-CALL, and instead to go to HOST-IP/~USERNAME/FILE-CALL. ?
Any ideas?
I'd suggest changing the references in your HTML to the files to be relative, as this will work either in a sub folder or as the root of the domain.
This works great when my page is in the root of the domain. However, I'm currently in the middle of transferring my site to a new hosting provider and as such have a temporary URL which is: HOST-IP/~username
How would I go about writing a rule in the .htaccess file that would redirect all file calls that start with a /, from going to HOST-IP/FILE-CALL, and instead to go to HOST-IP/~USERNAME/FILE-CALL. ?
Unless you can put a .htaccess at HOST-IP/.htaccess on the new server, you can't do this with .htaccess. It sounds like you're on a shared host, so any approach that'd let you do this with .htaccess would allow you to hijack everyone else's site on the server.

Issues with FastCGI and links containing index.php? versus index.php

On a Windows 2003 server running IIS 6.0 and FastCGI with an ExpressionEngine-powered website, I've encountered an issue where links containing index.php fail unless a question mark is added.
The basic issue is that if a link points to "index.php/archive/article", the page fails to load (see below) but it will work when "index.php?/archive/article" is used.
What happens when the "index.php" links fail is the URL will change in the browser address bar, but the main page content is still displayed. Append a question mark to "index.php" and the page loads properly.
The site was previously running with ISAPI as the Server API with no issues: the server saw "index.php" and "index.php?" as being synonymous and pages with "index.php" in the path would load as expected.
How would I configure setting somewhere which would tell FastCGI to treat "index.php" and "index.php?" the same way?
I am a bit green when it comes to Windows servers; my experience is mostly with Apache servers running on Unix boxes.
Any guidance or pointers would be most appreciated.
One option is that you could simply enable EE's force URL query string option.
But, if you don't like having the question mark in the URL, you can try this workaround.
I can't say that I know anything about Windows servers, but this has worked for me on Apache servers when running PHP as CGI. Best of luck!