I’m having trouble setting up the rule for the route I want correctly.
I have a SiteController action called “team”, so normally the route is localhost/site/team. I added this rule:
'team' => 'site/team'
So that the url will appear as localhost/team, but there’s also html sections that I navigate to with ’ #text ’ so instead of ‘site/team’, it’s ‘site/team/#text’ but that brings me to localhost/site/team/text# and I want it to also appear as ’ localhost/team/#text ’
I’ve tried a variety of rules like this:
'team/<id:\#[.*]>' => 'site/team/<id>'
The regular expression should match #text but it gives me a 404 error for localhost/team/#text. I’ve tried other regular expressions but can’t find one that works. Any help is appreciated
The #anchor section of the url is never transmitted to the server as far as I remember (check your access log). This may be your problem.
Try first by replacing # by “HASH” to validate that # is problematic
The problem is that you can’t use # in your url if you want to manage things using PHP.
I was suggesting using HASH or whatever instead of # first, to validate that your rules are ok. But at the end, you are going to need to use something else instead of # (that will never work for PHP url rules)