If i type a url without .html extenstion the page shows blank.
Posted: Tue Sep 09, 2008 12:51 pm
Hi I have just put my site live and I cant for life of me get the url rewrite to work properly. I need to get a 404 page working for urls typed in without .html extension idealy to redirect to home page
My problem is that if you type in www.mysite.com/hello.html it returns 404 because the page doesnt exist
if you type in www.mysite.com/hello it returns a blank page.
Hope someone can help.
Htaccess file is:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ /index.php?page=$1 [QSA]
config.php:
$config['assume_mod_rewrite'] = true;
$config['page_extension'] = '.html'; (I have tried this as:$config['page_extension'] = ''; )
$config['internal_pretty_urls'] = false;
$config['use_hierarchy'] = true;
I have tried both versions of the htaccess in the pretty urls instructions but both return blank pages.
Another problem is that I can not get a cutom error page to work.
I had created "error 404" page in admin and added
#404 redirect
ErrorDocument 404 /error-404.html
but it doesnt work. It always goes to server default 404
if you use custom 404 in admin this works. it must all be related to the htaccess file
Thanks,
My problem is that if you type in www.mysite.com/hello.html it returns 404 because the page doesnt exist
if you type in www.mysite.com/hello it returns a blank page.
Hope someone can help.
Htaccess file is:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ /index.php?page=$1 [QSA]
config.php:
$config['assume_mod_rewrite'] = true;
$config['page_extension'] = '.html'; (I have tried this as:$config['page_extension'] = ''; )
$config['internal_pretty_urls'] = false;
$config['use_hierarchy'] = true;
I have tried both versions of the htaccess in the pretty urls instructions but both return blank pages.
Another problem is that I can not get a cutom error page to work.
I had created "error 404" page in admin and added
#404 redirect
ErrorDocument 404 /error-404.html
but it doesnt work. It always goes to server default 404
if you use custom 404 in admin this works. it must all be related to the htaccess file
Thanks,