.htaccess - How To Redirect Non Existing URL's to the HomePage, When my site is in a Sub-directory....? -
i had .htaccess code worked fine when site , files in home root folder, changed new host had domains on it, site in subdirectory , following code no longer works:
rewritecond %{http_host} ^mydomain.com$ [or] rewritecond %{the_request} ^[a-z]{3,9}\ /index\.html rewriterule ^(index\.html)?$ http://www.mydomain.com/ [l,r=301]
how modify make work, need include subdirectory name in it? right if typed in non existing url "mydomain.com/blahblah567 ....it shows "page not found" type of thing.
thanks
how redirect non existing url's homepage
this enough:
errordocument 404 http://domain.com/
or using mod_rewrite
in subdir/.htaccess file:
rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ / [l,r=301]
Comments
Post a Comment