.htaccess - 301 page redirect

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
ravonet
Forum Members
Forum Members
Posts: 59
Joined: Fri Jan 11, 2008 12:04 pm

.htaccess - 301 page redirect

Post by ravonet »

I have the following .htaccess:
***************************************************

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]
RewriteCond %{HTTP_HOST} ^mydomain.dk
RewriteRule (.*) http://www.mydomain.dk/$1 [R=301,L]


# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"

RewriteCond %{QUERY_STRING} http\: [OR]

#OR if the URI contains a "["

RewriteCond %{QUERY_STRING} \[ [OR]

#OR if the URI contains a "]"

RewriteCond %{QUERY_STRING} \] [OR]

#OR if the URI contains a ""

RewriteCond %{QUERY_STRING} (\|%3E) [NC,OR]

#OR script trying to set a PHP GLOBALS variable via URL

RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]

#OR any script trying to modify a _REQUEST variable via URL

RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^.*$ - [F,L]

# END Filtering

# CMSMS Rewriting - Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
# Set assume mod_rewrite to true in config.php and clear CMSMS cache

RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.+)$ index.php?page=$1 [QSA]

************************************************************

Now I want to move some articles from my article-section to my blog - therefore I would like to do something like this:
But this does not work with my cmsms .htaccess - any idea why? - or how to solve the problem?

Mydomain.com - is a CMSMS website
Mydomain.com/blog - is a WordPress blog
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: .htaccess - 301 page redirect

Post by calguy1000 »

a) this is a CMSMS issue how?  you're only talking about .htaccess issues
b) did you crosspost this on wordpress forums too?
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
ravonet
Forum Members
Forum Members
Posts: 59
Joined: Fri Jan 11, 2008 12:04 pm

Re: .htaccess - 301 page redirect

Post by ravonet »

a) I got the .htaccess from using cmsms, so I thought some people might could help in this forum - sorry if I upset anyone - didn't ment to.
b) no?
ravonet
Forum Members
Forum Members
Posts: 59
Joined: Fri Jan 11, 2008 12:04 pm

Re: .htaccess - 301 page redirect

Post by ravonet »

To admin: You may delete this post - I will try to get help in another forum. Thanks
Pierre M.

Re: .htaccess - 301 page redirect

Post by Pierre M. »

Try any redirect before any rewrite. Or try to express all redirect as rewrites, again before other rewrites.
It seems much much much a mod_rewrite (not CMSms specific) issue.

Pierre M.
User avatar
superada
New Member
New Member
Posts: 3
Joined: Sat Nov 20, 2010 5:24 am

Re: .htaccess - 301 page redirect

Post by superada »

I use this for my site:
RewriteCond %{HTTP_HOST} ^example.com [NC]

      RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

      # Redirect client index.php requests to “/”
rewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
rewriteRule ^index\.php$ http://www.example.com/ [R=301,L]

# Redirect client index.html requests to “/”
rewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
rewriteRule ^index\.html$ http://www.example.com/ [R=301,L]
Post Reply

Return to “The Lounge”