last day (14 days later) » 

07:44
0
A: htaccess - Displaying same page through different URLs with URI passed to controllers

anubhavaYou don't really need P flag that is used for proxying the requests. You can just use this single rule: RewriteEngine On RewriteRule ^(?:city1|city2)/?$ / [L,NC]

Thanks for quick reply, however when using your rule I get a 404 as the server tries to get the page www.example.com/city1, which doesn't really exist.
Yes browser will display www.example.com/city1 but server will render www.example.com/. Make sure this is your first rule in site root .htaccess
If I remove P for the proxy the www.example.com page is not reached. the server tries to server www.example.com/city1 which doesn't exist. I believe the issue is more about keeping the proxy but somehow sending through the URI to the server? From my experiment it seems like if I use the proxy the URI is not reaching the server.
There is no need of using proxy here. I have several of these type rules working in live websites. Can you post your current .htaccess in question
I updated the question with the .htaccess file. I've run some tests and without P flag I can't get the homepage to display.
07:44
Just below RewriteEngine on insert this rule RewriteRule ^(?:city1|city2)/?$ index.php [L,NC] and then visit www.example.com/city1
I've tried that, It still gives me a 404 for city1 and city2
Hmm possibly Drupal doesn't like internal rewrites like some other PHP frameworks such as Wordpress
ok try this:

RewriteRule ^(?:city1|city2)/?$ index.php [P,L,NC]

just below RewriteEngine line
I've tried but since using index.php it never goes to home page, it always gives a 404
I've also check drupal internal rewrites and there is nothing to flag there ;?
how did you you check internal rewrites of Drupal?
drupal.org/node/38960 seems to use rewrite?
07:52
RewriteRule ^(?:city1|city2)/?$ /index.php [P,L,NC]

Try this rule as first rule.
This redirects to the homepage and remove the /city I guess that's removed by the index.php
no that is not removed by index.php, that is most likely due to mod_proxy not configured properly
Also drupal.org/node/38960 has example of an external redirect that uses R=301 flag. It is not an internal rewrite. Understand difference between redirect and rewrite.
hmm, appreciate your help :) The closest to what I want to achieve is the RewriteRule ^(?:city1|city2)/?$ / [P] However the controller doesn't get the city1 in the request uri
Yes that is because mod_proxy is not the solution to your problem. That will lose original /city1 after proxy redirect. See if this page helps you: drupal.org/docs/7/configuring-clean-urls/enable-clean-urls
I need to step away for some work. Will come back in an hour or so to address your comments or questions. Will keep this tab open.
Thanks very much for your help !
08:05
most welcome

last day (14 days later) »