Page 1 of 1

Mod_rewrite and multiple sub pages

Posted: Wed Nov 04, 2009 7:31 pm
by Golf Gti
I am having issues trying to 301 redirect a cmsms page that was deleted to another cmsms page that exsits.

Here is what I have in my .htaccess
Redirect 301 /sub1/sub2/page.html http://www.site.com/sub1/sub2/page2.html
what happens is it turns the url into:
http://www.site.com/sub1/sub2/page.html ... page2.html

The weird thing is I have the same rules setup for other pages and they redirect fine.
Do I have to have another rewite rule for having multiple sub pages?


RewriteEngine on
#Sub-dir e.g: /cmsms/
RewriteBase /

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


----------------------------------------------

Cms Version: 1.6.5

Installed Modules:

CMSMailer: 1.73.14
MenuManager: 1.6.2
ModuleManager: 1.3.1
News: 2.10.3
nuSOAP: 1.0.1
ThemeManager: 1.1.1
TinyMCE: 2.5.4
Banners: 2.2.1
MysqlDump: 1.2.3
FrontEndUsers: 1.6.9
Uploads: 1.8
SimpleGoogleMap: 1.1
FormBuilder: 0.5.11
CGExtensions: 1.17.4
CGSimpleSmarty: 1.4.3
SiteMapMadeSimple: 1.1.4
TreeManager: 0.6.0
CustomContent: 1.5.3
FileBackup: 0.5
Printing: 1.0.3
RateThis: 1.0
FEUMailer: 0.9.2.BETA
Captcha: 0.4
FCKeditorX: 1.1.0
Statistics: 0.9.3
Glossary: 0.6.8


Config Information:

php_memory_limit:
process_whole_template: false
max_upload_size: 1000000
default_upload_permission: 664
assume_mod_rewrite: true
page_extension: .html
internal_pretty_urls: false
use_hierarchy: true


Php Information:

phpversion: 5.2.9
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
memory_limit: 64M
max_execution_time: 60
safe_mode: Off (False)
session_save_path: /tmp (1777)


Server Information:

Server Api: cgi-fcgi
Server Db Type: MySQL (mysql)
Server Db Version: 5.1.30


----------------------------------------------

Re: Mod_rewrite and multiple sub pages

Posted: Wed Nov 04, 2009 8:27 pm
by JeremyBASS

Re: Mod_rewrite and multiple sub pages

Posted: Fri Nov 06, 2009 6:12 am
by JohnnyB
try the CMSMS seo rewrite like this:

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

note the [L]  instead of [QSA]

your original 301 redirect was ok...

Re: Mod_rewrite and multiple sub pages

Posted: Fri Nov 06, 2009 4:17 pm
by JeremyBASS
mww wrote: try the CMSMS seo rewrite like this:

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

note the [L]  instead of [QSA]

your original 301 redirect was ok...
Well... if $1 is the callback to the page_alias then you'd need to Append query string... yes?

[L] Last - stop processing rules
[QSA]Append query string

I'm not super on the mod_rewrite but I thought you had to have the query


here is my R301 for this site... http://www.hellscanyonsportfishing.com/  which is working just fine...

Code: Select all


RewriteRule ^steelheadpics\.html$ /albums/steelhead.html [R=301,L] 
RewriteRule ^fishing_smallmouthbass\.html$ /albums/bass.html [R=301,L] 

# CMSMS Rewriting
# 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]

so try

Code: Select all


RewriteRule ^/sub1/sub2/page\.html$ /sub1/sub2/page2.html [R=301,L] 

# CMSMS Rewriting
# 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]

Hope this helps
Cheers
Jeremy

Re: Mod_rewrite and multiple sub pages

Posted: Thu Dec 03, 2009 11:26 pm
by Golf Gti
OK, soo this mod_rewrite is the biggest headache!

If i use the [L] like below, the page will load the content but still have the /sub1/sub2/page.html?page=sub1/sub2/page2.html url. QSA will not load the content
mww wrote: try the CMSMS seo rewrite like this:

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

note the [L]  instead of [QSA]

your original 301 redirect was ok...
Also I have static pages under a different folder that will be cached as
/realfolder/realfolder/cmssub/cmspage.html
Instead of being redirected to root / , /cmssub/cmspage.html