Version 2.2.0
Note - all tests on same server
Note - I have spaced the h t t p in the below code as it was getting messed up on submission
Standard friendly urls are set up and working fine
So I have a fairly standard htaccess file as below:
# Friendly URLs Part
RewriteEngine On
RewriteBase /
#
# Force all pages to go to www.domain.co.uk for SEO
RewriteCond %{HTTP_HOST} !^www\.domain\.co.uk [NC]
RewriteRule (.*) h t t p ://www.domain.co.uk/$1 [R=301,L]
#
RewriteRule ^agency/([1-9][0-9]*)/?$ index.php?q=agency&agency=$1 [NC,L]
#
# Friendly URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Three main parts
- Standard modx re-write to force in www.
- Bit I have added which re-writes in a an additional query string for a specific page IE domain.co.uk/specificpage/1 to domain.co.uk/?q=specificpage&page_content_id=1
- Standard modx friendly urls re-write domain.co.uk/page to domain.co.uk/?q=page
I have tested this out side my site with just a very basic PHP page that returns the contents of print_r($_GET) and all seems to work fine (see inaction here -
http://tinyurl.com/cqyfg35) and it returns:
Array
(
[q] => agency
[agency] => 1
)
But when I add the htaccess to my Modx install the friendly urls work fine but the url for my page which requires the addition query string gets re-written to
domain.co.uk/specificpage and it drops the additional
/1.
Im assuming this is due to something Modx is doing - anyone have any ideas how to fix this ?
I really need to get this project live!
Thanks.
[ed. note: megasteve4 last edited this post 14 years, 4 months ago.]