Go Back   vb.org Archive > Community Discussions > Forum and Server Management
  #1  
Old 09-18-2008, 03:59 AM
gfxhelp.com gfxhelp.com is offline
 
Join Date: Aug 2008
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default .htaccess error pages

I want to make it so if someone types in a bad url it takes them back to my homepage. Currently the problem I'm having is if someone goes to:
http://www.gfx-help.com/blah123.html
or
http://www.gfx-help.com/blah123
it loads the error page which has the same code as the index.php. I would rather have it redirect back to index.php, but this still works. The problem is if someone goes to:

http://www.gfx-help.com/blah123/blah456/ all of the images and links don't work since most of them are not hard linked.

Does anyone have any idea how to do this? I basically just want any non-existent page to redirect back to my home page. I was thinking of just putting a meta redirect in each of the error pages, but perhaps there's a better way to do this?


My .htaccess currently looks like this...
Code:
ErrorDocument 400 /400.php
ErrorDocument 401 /401.php
ErrorDocument 403 /403.php
ErrorDocument 404 /404.php
ErrorDocument 404 /500.php

RewriteEngine on

RewriteCond %{HTTP_HOST} ^gfx-help.com$
RewriteRule ^/?$ "http\:\/\/www\.GFX\-Help\.com" [R=301,L]

RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{HTTP_HOST} ^gfx-help.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.gfx-help.com$
RewriteRule ^index.php$ "http\:\/\/www\.gfx\-help\.com\/" [R=301,L]


Options All -Indexes
Reply With Quote
  #2  
Old 09-18-2008, 04:33 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
ErrorDocument 400 /index.php
ErrorDocument 401 /index.php
ErrorDocument 403 /index.php
ErrorDocument 404 /index.php
ErrorDocument 404 /index.php
A page explaining the error, then redirecting would be nice.
Reply With Quote
  #3  
Old 09-18-2008, 05:00 AM
gfxhelp.com gfxhelp.com is offline
 
Join Date: Aug 2008
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works correctly now, but the issue is the paths for images/css are wrong if you go to a page like http://www.gfx-help.com/test1/test2/

I had a replacement variable for image paths which pointed to "images/theme", I changed that to "http://www.gfx-help.com/images/theme" and thought that would fix it, but it didn't help. Perhaps it's happening due to the css paths being incorrect?
Reply With Quote
  #4  
Old 09-18-2008, 05:20 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Add a base element to the top of your headinclude template:
HTML Code:
<base href="http://www.gfx-help.com/" />
Reply With Quote
  #5  
Old 09-18-2008, 05:30 AM
gfxhelp.com gfxhelp.com is offline
 
Join Date: Aug 2008
Posts: 99
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice, works perfect.

Thanks Dismounted
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:37 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09717 seconds
  • Memory Usage 2,193KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete