Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-25-2013, 06:12 PM
katie hunter's Avatar
katie hunter katie hunter is offline
 
Join Date: May 2007
Posts: 533
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default .htaccess rules redirects

Hi, I liked to redirect my non www. urls of my homepage to the www. urls

Ex http://nihonomaru.com/ should redirect to http://www.nihonomaru.com/

However, when i applied this rule to the .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

It is working but now on my forum, where i host my images on lightspeed, img1 subdomain, the images aren't appearing because they also get redirected i.e., img1 gets redirected to www.img1

See http://img1.nihonomaru.com/lighttpd/...edals/1231.gif

How can i apply an exclusion rule so the redirect doesn't not affect sub-domains? Or for only to apply the redirect for the homepage pages only?

Code:
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/forum/(.*)
RewriteCond %{REQUEST_URI} !^/img1/(.*)
RewriteCond %{REQUEST_URI} !^/cache/(.*)
RewriteCond %{REQUEST_URI} !^/lighttpd/(.*)

RewriteCond %{REQUEST_URI} !^forum\.nihonomaru\.com
RewriteCond %{REQUEST_URI} !^img1\.nihonomaru\.com
RewriteCond %{REQUEST_URI} ^/chan.*
RewriteRule (.*) - [L]

RewriteCond %{REQUEST_URI} "/lighttpd/"
RewriteRule (.*) $1 [L]

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{REQUEST_URI} !^img1\.nihonomaru\.com
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?nihonomaru.com$
RewriteRule ^$ public/ [L]

RewriteCond %{HTTP_HOST} ^(www\.)?nihonomaru.com$
RewriteRule (.*) public/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

</IfModule>
Reply With Quote
  #2  
Old 12-25-2013, 07:11 PM
vBNinja's Avatar
vBNinja vBNinja is offline
 
Join Date: May 2011
Location: USA
Posts: 239
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^img1\. [NC]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
That will only work for urls that start with "img1", if you have url's that start with a dynamic digit let me know so i can fix it
Reply With Quote
Благодарность от:
katie hunter
  #3  
Old 12-25-2013, 09:07 PM
katie hunter's Avatar
katie hunter katie hunter is offline
 
Join Date: May 2007
Posts: 533
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi vBNinja,

I added it to my .htaccess but I see an internal server error message.

Quote:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
This is my current entire rules:

Code:
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/forum/(.*)
RewriteCond %{REQUEST_URI} !^/cache/(.*)

RewriteCond %{REQUEST_URI} !^forum\.nihonomaru\.com
RewriteCond %{REQUEST_URI} ^/chan.*
RewriteRule (.*) - [L]

RewriteEngine On
RewriteCond %{HTTP_HOST} !^img1\. [NC]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?nihonomaru.com$
RewriteRule ^$ public/ [L]

RewriteCond %{HTTP_HOST} ^(www\.)?nihonomaru.com$
RewriteRule (.*) public/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

</IfModule>
Reply With Quote
  #4  
Old 12-26-2013, 12:56 AM
final kaoss final kaoss is offline
 
Join Date: Apr 2006
Posts: 1,314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here you go.

Code:
### BEGIN CLOUDFLARE REWRITE (domainB.com to www.domainB)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
### END CLOUDFLARE REWRITE ###################
Reply With Quote
  #5  
Old 12-26-2013, 02:06 AM
katie hunter's Avatar
katie hunter katie hunter is offline
 
Join Date: May 2007
Posts: 533
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by final kaoss View Post
Here you go.

Code:
### BEGIN CLOUDFLARE REWRITE (domainB.com to www.domainB)
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
### END CLOUDFLARE REWRITE ###################

Hi, why identifying it as specifically redirect everything on port 80 to the http URL?
Reply With Quote
  #6  
Old 12-26-2013, 02:19 AM
Max Taxable's Avatar
Max Taxable Max Taxable is offline
 
Join Date: Feb 2011
Posts: 3,134
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Side Note: You have a 404 missing or incorrectly named image here:
HTML Code:
URL: http://forum.nihonomaru.com/images/styles/OrangeTheme/style/headerBG.gif
Host: forum.nihonomaru.com
IP: 141.101.117.217
Location: Cloudflare
Error/Status Code: 404
Client Port: 56304
Start Offset: 1.308 s
Time to First Byte: 39 ms
Content Download: 0 ms
Bytes In (downloaded): 0.6 KB
Bytes Out (uploaded): 0.6 KB
Reply With Quote
  #7  
Old 12-26-2013, 02:51 AM
final kaoss final kaoss is offline
 
Join Date: Apr 2006
Posts: 1,314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not too sure if that matters too much but that's what I've come up with after browsing through several tutorials & articles.

Also I realize that this plugin is a vb3 plugin but it still seems to get the job done in vb4 as well (I've used it for a couple of years now).
https://vborg.vbsupport.ru/showthread.php?t=222898
Quote:
Originally Posted by katie hunter View Post
Hi, why identifying it as specifically redirect everything on port 80 to the http URL?
Reply With Quote
  #8  
Old 12-26-2013, 04:16 AM
katie hunter's Avatar
katie hunter katie hunter is offline
 
Join Date: May 2007
Posts: 533
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Max Taxable View Post
Side Note: You have a 404 missing or incorrectly named image here:
HTML Code:
URL: http://forum.nihonomaru.com/images/styles/OrangeTheme/style/headerBG.gif
Host: forum.nihonomaru.com
IP: 141.101.117.217
Location: Cloudflare
Error/Status Code: 404
Client Port: 56304
Start Offset: 1.308 s
Time to First Byte: 39 ms
Content Download: 0 ms
Bytes In (downloaded): 0.6 KB
Bytes Out (uploaded): 0.6 KB
It is embed correctly in here http://forum.nihonomaru.com/azskinz/...e/headerBG.gif

I can't seem to find where this url is in the template.

Code:
#headerMain {
    background: url(azskinz/nihonomaru/style/headerBG.gif) repeat-x scroll left top transparent;
    height: 96px;
    padding: 0 20px;
    position: relative;
}
Quote:
Originally Posted by final kaoss View Post
Not too sure if that matters too much but that's what I've come up with after browsing through several tutorials & articles.

Also I realize that this plugin is a vb3 plugin but it still seems to get the job done in vb4 as well (I've used it for a couple of years now).
https://vborg.vbsupport.ru/showthread.php?t=222898
I prefer if i don't use any weird plugin's for this, usually .htaccess works + this is outdated i mean it works for vb 3.8 not 4.x.

I don't really have an issue with my forum url, it is working perfectly, my issue is for the sub domain img1 which is lightspeed that is hosting my forum images.
Reply With Quote
  #9  
Old 12-26-2013, 04:32 AM
final kaoss final kaoss is offline
 
Join Date: Apr 2006
Posts: 1,314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry about that, been posting while I'm half awake over here.

Try this solution.
http://stackoverflow.com/questions/1...ailing-slashes
Reply With Quote
  #10  
Old 12-26-2013, 05:04 AM
katie hunter's Avatar
katie hunter katie hunter is offline
 
Join Date: May 2007
Posts: 533
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

We can check it tomorrow thanks for your help!

I tried it but it didn't work:

Code:
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/forum/(.*)
RewriteCond %{REQUEST_URI} !^/cache/(.*)

RewriteCond %{REQUEST_URI} !^forum\.nihonomaru\.com
RewriteCond %{REQUEST_URI} ^/chan.*
RewriteRule (.*) - [L]

#Force www.
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^nihonomaru\.com$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?nihonomaru.com$
RewriteRule ^$ public/ [L]

RewriteCond %{HTTP_HOST} ^(www\.)?nihonomaru.com$
RewriteRule (.*) public/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

</IfModule>

I also added this part as well and it didn't work, unless i did something wrong

Code:
#Remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.+)/$ /$1 [R=301,L]
Reply With Quote
Reply


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 02:01 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05474 seconds
  • Memory Usage 2,275KB
  • Queries Executed 11 (?)
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
  • (8)bbcode_code
  • (2)bbcode_html
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete