404 redirect and keep extensionless URL? - url-rewriting

I'm setting up custom 404 redirects (.htaccess is not an option as I'm on IIS6), is there a way to do this and still keep the 'fancy' url in the address bar?

There is not such thing as "404 redirects". 4xx range means error.
In any case -- you can use ISAPI_Rewrite 3 which will bring mod_rewrite support via .htaccess to your IIS6 server. It has Light version which is free.

Related

Umbraco 7 URL rewriting

I am trying to add url rewrites
My current URL http://some_domain.co.uk/category/page_name/
I am trying to keep existing site urls functioning with below URL
http://some_domain.co.uk/category/page_name.htm
Any help appreciated.
Thanks!
i would highly recommend keeping the current URL structure, it's cleaner, and maintainability will be easier.
If your worried about the SEO or the dead links after the new site goes live then how about doing 301 redirect instead?
Umbraco has a plugin that helps you do 301 redirect and keep track of all the 404 pages, and you can view the report and 301 redirect those 404 pages.
http://our.umbraco.org/projects/developer-tools/301-url-tracker
In the example above,
http://some_domain.co.uk/category/page_name.htm
will get redirected to
http://some_domain.co.uk/category/page_name/

How does 301 redirect works

In a typical DNS like GoDaddy and Yahoo, can a 301 redirect do this:
http://mysite.com/abc to http://www.mysite.com/abc
However it seems its not possible; Can the app in the otherdomain know the subfolder?
Update:
What I mean are those DNS redirects, specifically from naked domain to a www domain
Update:
I managed to forward the naked domain from http://mysite.com to http://www.mysite.com/index.html So can I get the requested subfolder through javascript in the index.html?
Or the re-direct loses the subfolder originally requested?
The HTTP 301 response is not handled by DNS. It's a response emitted by a web server to indicate to the browser that the requested resource has been moved permanently to a new location, and it includes a Location: header with the new URL
For example:
HTTP/1.1 301 Moved Permanently
Location: http://www.example.org/index.asp
As you see, the location header can contain contain any valid URL, including a folder name.
Setting this up is server dependent, but Apache's mod_rewrite is certainly capable of rewriting URLs and including the requested folder name in the response.
If you are on a LAMP stack box, you can use .htaccess to redirect. You can redirect any page on site1 to any page on site2.
Redirect 301 /old-page-name http://www.your-domain.com/new-page-name
note, this is not a DNS solution, but I think you might not be looking for a strictly DNS-related answer.

codeigniter custom 500 error

At this very moment I do not have any 500 error being thrown, but in case I ever do in the future I'm trying to customize a page so users never see that awful white screen.
I am having trouble adding said page. I have the page made and a controller that loads the page, but when I try and route the page in the route file or route it using .htaccess I'm still getting that white screen.
This is what I have tried in my route file
$route['500_override'] = 'notFoundErrorPage/serverError';
and then this is what I have tried in my .htaccess
ErrorDocument 500 http://writeyourfiction.com/NotFoundErrorPage/serverError
any help would be wonderful!
CodeIgniter does not have any custom error handlers aside from 404_override, so using one for any other HTTP code will be fruitless.
Apache has custom error pages as you've already attempted, but there are a couple of things to note that may be affecting your results:
1: A local URL begins with a /
A local URL to redirect to (if the action begins with a "/").
2: Specifying in an .htaccess may require additional configuration:
It may be used in .htaccess files if AllowOverride is set to FileInfo.
If you seek additional help, either here or elsewhere, please provide more information about your server environment: operating system, web server (e.g. Apache) and version, any relevant add-ons or modifications you may have made, etc.
It depends on the server software you are using. If you are using Apache, see here: http://httpd.apache.org/docs/2.2/custom-error.html
If you aren't using apache, google "[webserver software] custom 500 page".
If you're still having trouble, try asking on serverfault.com.

Getting 401 error in Joomla backend when trying to login\logout or edit anything

I have a website built on Joomla.Everything seemed to be going fine when all of a sudden I am noticing the following.
When I go to the administrator login page, once I fill my details and press login, I am getting a 401.shtml page with following message -
"Not Found
The requested URL /401.shtml was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_perl/2.0.5 Perl/v5.8.8 Server at www.shillingstudios.com Port 80"
Now as per my understanding the 401 error would mean that I do not have the authorization to visit that page or do what I am trying to do.Maybe I am not entering the correct username or password.
However,my username and password are correct.Moreover if I go back to the admin login page I find that I am logged into the administrator panel, which means that my login attempt was successful even though I was directed to 401.shtml page.
The same thing happens when I try to logout(on refresh I find that I had successfully logged out)
When I try to Save/Edit/Close an Article/Category/Section I am redirected to the same page.But in each instance I am actually able to successfully do what I was trying to do.
The only change that I made prior to this issue was installing following plug-ins:
Set Generator tag plug-in
Title Manager plug-in
I installed both plug-ins for SEO purpose from http://extensions.joomla.org/extensions/site-management/seo-a-metadata
I thought that the issue might have caused due to installing these plug-ins so I disabled them, but the problem is still there.
I am trying to setup a website for an Android game that I am developing and Joomla seemed a good option for creating my own website. However I do not have much idea about PHP or MySQL or how Apache server works.So I am not able to determine why this is happening and what can possibly fix this, so any help will be appreciated.
You could try making sure that your website URL is in the 'live site' field in the config.php file. That can sometimes help.
First you should create your custom error pages – you can use a text/HTML editor of your choice (for example Dreamweaver). Once you are ready with the pages, upload them into a subdirectory of your public_html called errors. Then open your main .htaccess file and add the following lines in it:
serve custom error pages
ErrorDocument 400 /errors/400.html
ErrorDocument 401 /errors/401.html
ErrorDocument 403 /errors/403.html
ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html
Important settings:
Search Engine Friendly URLs: Yes
Use Apache mod_rewrite: Yes
Mod_login settings: All defaults from installation
edit:
I did rename htaccess.txt into .htaccess

MVC Routing / HostHeader does not work when I use RequireHttps

I'm currently experiencing an issue whereby my MVC site is not responding correctly using IIS 6.
I've setup a url as http://mysite.co.uk which automatically redirects to the correct MVC home page. As the site contains sensitive information I have added the [RequireHttps] attribute to each controller class to automatically redirect the browser to an https url of https://mysite.co.uk which works correctly.
When I access the site as http://www.mysite.co.uk the site correctly redirects to https://www.mysite.co.uk/Default.aspx but it then responds with
Bad Request (Invalid Hostname)
It looks like any time I use www. as part of the url it fails to respond but I have a hostheader setup as www.mysite.co.uk under the IIS website. Is there anything in particular I need to do to make MVC understand the www. part of the url in terms of routing?
Thanks,
Brian.
IIS 6 doesn't add ssl host headers as you think it would. see my article at:
http://completedevelopment.blogspot.com/2009/06/multiple-host-headers-ssl-and-wcf.html

Resources