Strange behavior for missing files with short urls

My web server shows an error for missing pages. These urls are all 404:

http://my.web.site/missing.html
http://my.web.site/missing/
http://my.web.site/missing

      

But these urls are redirected to /

with a status code 301 Moved Permanently

:

http://my.web.site/m/
http://my.web.site/m

      

Why aren't these URLs 404? And how can I turn off 301 redirection?

Since I do not have access to http.conf on this shared server (Apache), I am looking for a solution in .htaccess.

Just to clarify: I want all the missing 404 pages.


Note:

The observed behavior (301 for single letter urls) is the default for my (shared) webspace. There is currently no .htaccess file . I want to solve this problem with a .htaccess file.

+3


source to share


2 answers


The behavior described in my question is caused by the Apache module mod_spelling

. Creation .htaccess

with

CheckSpelling Off

solved a problem.




I am disappointed that my award was given to an โ€œanswerโ€ that (a) did not answer my question, (b) offered a โ€œsolutionโ€ that would lead to the exact behavior I was trying to avoid (301), and (c) my a comment that indicates this was ignored by the respondent.

+2


source


since you know you don't have access to the http.conf file, so first you need to check if your htaccess rewrite is working or not.

If it works (to test it you can write some environment variable

SetEnv APPLICATION_ENV dev_dev

      

and check $_SERVER

Now is the time to do something in htaccess for a 301 redirect



I wrote this code in my HTACCESS

RewriteEngine on

RewriteRule ^testurl/?$ /home/? [L,NC,R=301]

      

I don't know what you want to redirect from which url to which, but in my code xyz.com/testurl will be redirected to xyz.com/home

here's my codeIgniter app so you have a .php or .html page extension like this

+1


source







All Articles