Forum Moderators: phranque
Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} www.mysite.com$
RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]
RewriteRule ^[^/]+/.+-([0-9]+)/$ /community/index.php?threads/$1/ [R=301,L]
RewriteRule ^forum\.php$ /community/ [R=301,L]
RewriteRule ^(images|dir2|dir3|dir4)/.*$ - [S=1]
RewriteRule ^.*$ /community/ [R=301,L]
Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} www.mysite.com$
RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]
RewriteRule ^[^/]+/.+-([0-9]+)/$ /community/index.php?threads/$1/ [R=301,L]
RewriteRule ^forum\.php$ /community/ [R=301,L]
RewriteRule ^(images|dir2|dir3|dir4)/.*$ - [S=1]
RewriteRule ^.*$ /community/ [R=301,L]
# Use PHP 5.3
AddType application/x-httpd-php53 .php
# Ticket PBB-18872701
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/admin/public_html
<Files php.ini>
order allow,deny
deny from all
</Files>
</IfModule>
# Ticket PBB-18872701
DirectoryIndex index.php
#RewriteEngine Off
# Comment the following line (add '#' at the beginning)
# to disable mod_rewrite functions.
# Please note: you still need to disable the hack in
# the vBSEO control panel to stop url rewrites.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.com$
RewriteRule ^/?$ "http\:\/\/www\.mysite\.com\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^mysite.com$
RewriteRule ^forum\.php\/?(.*)$ "http\:\/\/www\.mysite\.com\/forum\.php$1" [R=301,L]
# Some servers require the Rewritebase directive to be
# enabled (remove '#' at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root vB folder (i.e. RewriteBase /forums/)
#RewriteBase /
#RewriteCond %{HTTP_HOST} !^www\.mysite\.com
#RewriteRule (.*) http://www.mysite.com/$1 [L,R=301]
RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
RewriteCond %{REQUEST_URI} !(admincpvioc1/|modcpvioc2/|cron|vbseo_sitemap)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/(admincpvioc1|modcpvioc2|clientscript|cpstyles|images)/
RewriteRule ^(.+)$ vbseo.php [L,QSA]
<Files 403.shtml>
order allow,deny
allow from all
</Files>
RewriteCond %{HTTP_USER_AGENT} ^Baiduspider.* [NC]
#RewriteCond %{HTTP_HOST} ^mysite.com$
#RewriteRule ^/?$ "http\:\/\/www\.mysite\.com\/" [R=301,L]
#RewriteCond %{HTTP_HOST} ^mysite.com$
#RewriteRule ^forum\.+\/?(.*)$ "http\:\/\/www\.mysite\.com\/forum\.php$1" [R=301,L]
# Expire images header
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>
RewriteEngine On
RewriteRule ^Microsoft-Server-ActiveSync$ hgpush/index.php
RewriteCond %{HTTP_HOST} www.mysite.com$
RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^(example.com)?$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L] RewriteRule ^[^/]+/.+-([0-9]+)/$ /community/index.php?threads/$1/ [R=301,L]
RewriteRule ^forum\.php$ /community/ [R=301,L]
RewriteRule ^(images|dir2|dir3|dir4)/.*$ - [S=1]
RewriteRule ^.*$ /community/ [R=301,L]
RewriteRule ^[^/]+/.+-([0-9]+)/$ http://example.com/community/index.php?threads/$1/ [R=301,L]
RewriteRule ^forum\.php$ http://example.com/community/ [R=301,L]
RewriteRule ^(images|dir2|dir3|dir4)/.*$ - [S=1]
RewriteRule ^.*$ http://example.com/community/ [R=301,L] RewriteCond %{HTTP_HOST} ^mysite.com$
RewriteRule ^/?$ "http\:\/\/www\.mysite\.com\/" [R=301,L]
RewriteCond %{HTTP_USER_AGENT} ^Baiduspider.* [NC]
RewriteRule ^.*$ /community/ [R=301,L] RewriteRule ^$ /community/ [R=301,L] Options -Indexes
RewriteEngine On
RewriteRule ^[^/]+/.+-([0-9]+)/$ http://example.com/community/index.php?threads/$1/ [R=301,L]
RewriteRule ^forum\.php$ http://example.com/community/ [R=301,L]
RewriteRule ^(images|dir2|dir3|dir4)/.*$ - [S=1]
RewriteRule ^.*$ http://example.com/community/ [R=301,L]
RewriteCond %{HTTP_HOST} !^(example.com)?$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]
# Use PHP 5.3
AddType application/x-httpd-php53 .php
# Ticket PBB-18872701
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/admin/public_html
<Files php.ini>
order allow,deny
deny from all
</Files>
</IfModule>
# Ticket PBB-18872701
DirectoryIndex index.php
#RewriteEngine Off
# Comment the following line (add '#' at the beginning)
# to disable mod_rewrite functions.
# Please note: you still need to disable the hack in
# the vBSEO control panel to stop url rewrites.
RewriteEngine On
# Some servers require the Rewritebase directive to be
# enabled (remove '#' at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root vB folder (i.e. RewriteBase /forums/)
#RewriteBase /
#RewriteCond %{HTTP_HOST} !^www\.example\.com
#RewriteRule (.*) http://www.example.com/$1 [L,R=301]
<Files 403.shtml>
order allow,deny
allow from all
</Files>
#RewriteCond %{HTTP_HOST} ^example.com$
#RewriteRule ^/?$ "http\:\/\/www\.example\.com\/" [R=301,L]
#RewriteCond %{HTTP_HOST} ^example.com$
#RewriteRule ^forum\.+\/?(.*)$"http\:\/\/www\.example\.com\/forum\.php$1" [R=301,L]
# Expire images header
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>
RewriteEngine On
RewriteRule ^Microsoft-Server-ActiveSync$ hgpush/index.php
[edited by: tommydamic68 at 7:14 pm (utc) on Jan 12, 2014]
I changed this:
RewriteRule ^.*$ /community/ [R=301,L]
To this:
RewriteRule ^$ /community/ [R=301,L]
Oh, excellent, because that was the rule that really jumped out and hit me in the face. As originally written, it said "send ALL requests of all kinds-- except the ones in the four previously excluded subdirectories-- to /community/". You still need to give the full protocol-plus-hostname in the target. This is not redundant, because any specific rules come before the with/without www redirect.
Won't search engines get confused if all requests for the root are redirected to a subdirectory?
In the message-posting window, click Style Codes (link on the left) to see what's available. WebmasterWorld is a handrolled forum that predates things like php/bb, so its formats are sometimes different from what you're used to. If you use Quick Reply, hit Preview to get the full posting window. You can also select text and then click the appropriate format button.
Anything beginning in http:// will be turned into a clickable link, with full URL concealed, unless you use example.com. Or example.anything-else.
!^(example\.com)?$ RewriteRule ^$ http://example.com/community/ [R=301,L] In other word I get example.com/community no matter what combination of my sites address is typed in the browser.
the forum files is not in the root folder but are in the community folder. so public_html/community
Do you mean that you do get, or that you want to get? And by "get" do you mean the page content or the URL?
If you are typing in
http://www.example.com/
and you get redirected (browser's address bar changes) to
http://example.com/community/
then everything is happening correctly.
Here are the changes you suggested:
Options -Indexes
RewriteEngine On
RewriteRule ^[^/]+/.+-([0-9]+)/$ http://example.com/community/index.php?threads/$1/ [R=301,L]
RewriteRule ^forum\.php$ http://example.com/community/ [R=301,L]
RewriteRule ^(images|dir2|dir3|dir4)/.*$ - [S=1]
RewriteRule ^.*$ http://example.com/community/ [R=301,L]
RewriteCond %{HTTP_HOST} !^(example.com)?$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]
RewriteEngine On
RewriteRule ^[^/]+/.+-([0-9]+)/$ http://example.com/community/index.php?threads/$1/ [R=301,L]
RewriteRule ^forum\.php$ http://example.com/community/ [R=301,L]
RewriteRule ^(images|dir2|dir3|dir4)/.*$ - [S=1]
RewriteRule ^$ http://example.com/community/ [R=301,L]
RewriteCond %{HTTP_HOST} !^(example.com)?$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]
RewriteRule ^[^/]+/.+-([0-9]+)/$ http://example.com/community/index.php?threads/$1/ [R=301,L]
RewriteRule ^[^/]+/.+-([0-9]+)/$ http://example.com/community/?threads/$1/ [R=301,L] What is happening is this - when i type example.com or www.example.com i get example.com/community
however, i can also type the url direct into the browser www.example.com/community and it be its own url - so i have example.com/community and www.example.com/community shouldn't it default to example.com/community when typing in www.example.com/community - if so, thats what i am trying to achieve.
RewriteCond %{HTTP_HOST} !^(example.com)?$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^(example.com)?$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]
Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(example.com)?$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} www.example.com$
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
RewriteRule ^[^/]+/.+-([0-9]+)/$ /community/index.php?threads/$1/ [R=301,L]
RewriteRule ^forum\.php$ /community/ [R=301,L]
RewriteRule ^(images|dir2|dir3|dir4)/.*$ - [S=1]
RewriteRule ^$ /community/ [R=301,L]
# Use PHP 5.3
AddType application/x-httpd-php53 .php
DirectoryIndex index.php
#RewriteEngine Off
# Comment the following line (add '#' at the beginning)
# to disable mod_rewrite functions.
# Please note: you still need to disable the hack in
# the vBSEO control panel to stop url rewrites.
# Some servers require the Rewritebase directive to be
# enabled (remove '#' at the beginning to activate)
# Please note: when enabled, you must include the path
# to your root vB folder (i.e. RewriteBase /forums/)
#RewriteBase /
#RewriteCond %{HTTP_HOST} !^www\.example\.com
#RewriteRule (.*) http://www.example.com/$1 [L,R=301]
<Files 403.shtml>
order allow,deny
allow from all
</Files>
#RewriteCond %{HTTP_HOST} ^example.com$
#RewriteRule ^/?$ "http\:\/\/www\.example\.com\/" [R=301,L]
#RewriteCond %{HTTP_HOST} ^example.com$
#RewriteRule ^forum\.+\/?(.*)$ "http\:\/\/www\.example\.com\/forum\.php$1" [R=301,L]
# Expire images header
ExpiresActive On
ExpiresDefault A0
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/ico A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>
[edited by: phranque at 7:45 pm (utc) on Jan 13, 2014]
[edit reason] Please Use example.com [webmasterworld.com] [/edit]
typing www.example.com/community should lead to example.com/community and vice versa.
RewriteCond %{HTTP_HOST} !^(example.com)?$ [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} www.example.com$
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
RewriteRule ^[^/]+/.+-([0-9]+)/$ /community/index.php?threads/$1/ [R=301,L]
RewriteRule ^forum\.php$ /community/ [R=301,L]
RewriteRule ^(images|dir2|dir3|dir4)/.*$ - [S=1]
RewriteRule ^$ /community/ [R=301,L]
http://www.example.com/index.shtm
http://example.com/index.shtml
http://www.example.com/index.asp
http://example.com/index.asp
http://www.example.com/default.asp
http://example.com/default.asp
http://www.example.com/index.cfm
http://example.com/index.cfm
http://www.example.com/index.pl
http://example.com/index.pl
# Directory Index
DirectoryIndex index.html
# Redirect default.aspx and index.html requests to URL ending / on www
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(default|index)\.(aspx|html?)\ HTTP
RewriteRule ^(([^/]+/)*)(default|index)\.(aspx|html?)$ http://www.example.com/$1? [R=301,L]
# Redirect .html URL requests to equivalent .aspx URLs on www
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*[^/.]+\.html\ HTTP
RewriteRule ^(([^/]+/)*[^/.]+)\.html$ http://www.example.com/$1.aspx [R=301,L]
# Redirect non-canonical requests to www
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
# Internally rewrite .aspx URL requests to .html file
RewriteRule ^(([^/]+/)*[^/.]+)\.aspx$ /$1.html [L]
#Redirect VBSEO
RewriteEngine on
RewriteRule f[\d]+/.+-([\d]+)/index([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
RewriteRule f[\d]+/.+-([\d]+)/ showthread.php?t=$1 [NC,L]
RewriteRule f([\d]+)/index([\d]+).html forumdisplay.php?f=$1&page=$2 [NC,L]
RewriteRule f([\d]+)/ forumdisplay.php?f=$1 [NC,L]
#redirect Index
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
#ErrorDocument 404 /404.shtml
ErrorDocument 404 /layout1/index.html
ErrorDocument 500 default
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [OR]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^$ http://example.com/community/$1 [R=301,L]
# Use PHP 5.4
AddType application/x-httpd-php54 .php
DirectoryIndex index.php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(default|index)\.(aspx|html?)\ HTTP
RewriteRule ^(([^/]+/)*)(default|index)\.(aspx|html?)$ http://www.example.com/$1? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(default|index)\.(aspx?|s?html?)\ HTTP
RewriteRule ^(([^/]+/)*)(default|index)\.(aspx?|s?html?)$ http://www.example.com/$1? [R=301,L]
As of now they default to 404
RewriteCond %{THE_REQUEST} \.[a-z] [NC]
RewriteRule ^(([^/]+/)*)(?:index|main|default)\.\w+ et cetera with [NC] flag again http://www.example.com/index.cfm
http://example.com/index.cfm
http://www.example.com/index.pl
http://example.com/index.pl
Options -Indexes
#redirect Index
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(default|index)\.(aspx?|s?html?)\ HTTP
RewriteRule ^(([^/]+/)*)(default|index)\.(aspx?|s?html?)$ http://www.example.com/$1? [R=301,L]
#Redirect VBSEO
RewriteEngine on
RewriteRule f[\d]+/.+-([\d]+)/index([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
RewriteRule f[\d]+/.+-([\d]+)/ showthread.php?t=$1 [NC,L]
RewriteRule f([\d]+)/index([\d]+).html forumdisplay.php?f=$1&page=$2 [NC,L]
RewriteRule f([\d]+)/ forumdisplay.php?f=$1 [NC,L]
#ErrorDocument 404 /404.shtml
ErrorDocument 404 /layout1/index.html
ErrorDocument 500 default
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [OR]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^$ http://example.com/community/$1 [R=301,L]
# Use PHP 5.4
AddType application/x-httpd-php54 .php
DirectoryIndex index.php
\.(aspx?|s?html?
# Protect htaccess
<files .htaccess="">
order allow,deny
deny from all
</files>
# Don't show directories
Options -Indexes
# ErrorDocument 404 /404.shtml
ErrorDocument 404 /error/bara-index.html
ErrorDocument 500 default
# Use PHP 5.4
AddType application/x-httpd-php54 .php
# Directory Index
DirectoryIndex index.html index.php
# Redirect VBSEO
RewriteEngine on
RewriteRule f[\d]+/.+-([\d]+)/index([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
RewriteRule f[\d]+/.+-([\d]+)/ showthread.php?t=$1 [NC,L]
RewriteRule f([\d]+)/index([\d]+).html forumdisplay.php?f=$1&page=$2 [NC,L]
RewriteRule f([\d]+)/ forumdisplay.php?f=$1 [NC,L]
# Redirect index.php
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [OR]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^$ http://example.com/community/$1 [R=301,L]
# Redirect index.aspx|html|php|shtml|cfm|pl
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(default|index)\.(php?|aspx?|s?html?|cfm?|pl?)\ HTTP
RewriteRule ^(([^/]+/)*)(default|index)\.(php?|aspx?|s?html?|cfm?|pl?)$ http://www.example.com/$1? [R=301,L]
RewriteRule ^Microsoft-Server-ActiveSync$ hgpush/index.php
# Banned IP's
<Files 403.shtml>
order allow,deny
allow from all
</Files>
deny from 71.202.73.121
deny from 71.54.55.37
deny from 71.23.138.88
deny from 209.240.114.5
deny from 24.203.173.212
deny from 184.98.48.33
deny from 68.235.138.222
deny from 74.179.106.144
deny from 71.202.244.106
deny from 96.236.234.3
deny from 99.149.120.208
deny from 50.54.159.180
deny from 75.31.124.21
deny from 24.22.205.44
#The following line is enough for .js and .css
<IfModule mod_deflate.c>
AddOutputFilter DEFLATE js css
AddOutputFilterByType DEFLATE text/plain text/xml application/xhtml+xml text/css application/xml application/rss+xml application/atom_xml application/x-javascript application/x-httpd-php application/x-httpd-fastphp text/html
#The following lines are to avoid bugs with some browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
# BEGIN EXPIRES
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 10 days"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/plain "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-icon "access plus 1 year"
</IfModule>
# END EXPIRES
# Cache Headers
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz)$">
Header append Vary Accept-Encoding
</FilesMatch>
<FilesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</FilesMatch>
<FilesMatch "\.(css)$">
Header set Cache-Control "public"
</FilesMatch>
<FilesMatch "\.(js)$">
Header set Cache-Control "private"
</FilesMatch>
<FilesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</FilesMatch>
</IfModule>