I have been attempting to setup friendly urls for a dynamic page that shows a different chatroom based on a chanid parameter.
I am using Revolution 2.0.6 or it’s using me I can’t tell which yet.
The page is setup using the alias ’chatrooms/chatroom’
My rewriterules:
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [S=2,L]
RewriteRule ^chatrooms/([^/]+)/([^/]+)/?$ index.php?q=chatrooms/$1/?chanid=$2 [L]
RewriteRule ^(.*)$ index.php?q=$1 [L]
This URL (/chatrooms/chatroom/12345/)will do a rewrite correctly to:
index.php?q=chatrooms/chatroom/?chanid=12345 but shows a 404 page. It appears if it is trying to check the alias ’chatrooms/chatroom/?chanid=12345’ instead of ’chatrooms/chatroom/’ and adding the parameter ’chanid=12345’
If I change
RewriteRule ^chatrooms/([^/]+)/([^/]+)/?$ index.php?q=chatrooms/$1/?chanid=$2 [L]
To read
RewriteRule ^chatrooms/([^/]+)/([^/]+)/?$ index.php?q=chatrooms/$1/ [L]
everythng works as expected but of course I don’t get the chanid to display the correct room.
If I change to this:
RewriteRule ^chatrooms/([^/]+)/([^/]+)/?$ index.php?q=chatrooms/$1/&chanid=$2 [L]
Then index.php does a redirect to /chatrooms/chatroom/ and loses the chanid.
So how is it I can pass the chanid to index.php and stop it from doing a redirect and removing the chanid parameter.
I would appreciate any help here. I have been working on this one line of htaccess code for 2 days now. As far as I can tell this code is working correctly but then MODx does something I am not expecting or don’t understand why it is doing it.
Thanks