Mod_rewrite and multiple sub pages

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
Golf Gti

Mod_rewrite and multiple sub pages

Post 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


----------------------------------------------
Last edited by Golf Gti on Wed Nov 04, 2009 7:36 pm, edited 1 time in total.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Mod_rewrite and multiple sub pages

Post 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...
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
JeremyBASS

Re: Mod_rewrite and multiple sub pages

Post 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
Golf Gti

Re: Mod_rewrite and multiple sub pages

Post 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
Last edited by Golf Gti on Sat Dec 05, 2009 4:27 am, edited 1 time in total.
Locked

Return to “CMSMS Core”