Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4552734
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:50:21+00:00 2026-05-21T16:50:21+00:00

I found a comment here: http://bakery.cakephp.org/articles/PHPdiddy/2006/10/06/custom-urls-from-the-site-root That said: Just change last line. Router::connect(‘/ ‘,

  • 0

I found a comment here: http://bakery.cakephp.org/articles/PHPdiddy/2006/10/06/custom-urls-from-the-site-root

That said:

Just change last line.
Router::connect(‘/‘,
array(‘controller’ => ‘members’,
‘action’ => ‘show’));
to
Router::connect(‘(?!admin|items|images)(.
*)’,
array(‘controller’ => ‘members’, ‘action’ => ‘show’));

Some people were able to get that to work… It didn’t look quite right to me though so I tried the following, but still had no luck:

Router::connect('(?!/admin|/items|/images)(/.*)',
array('controller' => 'members','action' => 'show'));

In any case, the goal is to have a url like http://domainname/username , map to a users unique id. It works with /*, but I rather not use that method. Ideas?

Update to solution:
I used the selected answer below and added the following. It may be helpful to someone else.

$misc = array(*your misc webroot, admin route items here...*);
$notList = array_merge(Configure::listObjects('plugin'),Configure::listObjects('controller'));
$notListLowerCase = array();
foreach ($notList as $key=>$item):
    $notListLowerCase[] = strtolower(preg_replace("/(.)([A-Z])/","\\1_\\2",$item));
endforeach;
$notList = array_merge($notList,$misc,$notListLowerCase);
$notList = implode('|', $notList);

Router::connect('/:username', 
        array(
            'controller'=>'users', 
            'action'=>'view'
        ),   
        array(
            'username' => '\b(?:(?!'.$notList.')\w)+\b'
        )
    );
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T16:50:22+00:00Added an answer on May 21, 2026 at 4:50 pm

    Here ya go. You need to capture it as a param and then reference it in the regex. The username will be available in $this->params[‘username’] in the controller action.

    Router::connect('/:username', 
        array(
            'controller'=>'members', 
            'action'=>'show'
        ),   
        array(
            'username' => '\b(?:(?!admin|items|images)\w)+\b'
        )
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a simple php form I found here http://www.1stwebdesigner.com/tutorials/custom-php-contact-forms/comment-page-2/#comments But I am
I'm using the source code found on this site here: http://webtint.net/tutorials/5-star-rating-system-in-php-mysql-and-jquery/comment-page-1/#comment-2562 A fantastic resource,
Hi I'm trying to use the CakePHP comments plugin found here http://cakedc.com/downloads/view/cakephp_comments_plugin but the
I'm trying to run the script found here: http://blog.sebflipper.co.uk/2010/03/10/mysql-backup-as-separate-sql-files-with-rotation/comment-page-1/ bash /path/to/mysql-backup.sh I'm getting the
So, here is the discussion I have just read: http://www.mail-archive.com/delphi@delphi.org.nz/msg02315.html BeginUpdate and EndUpdate is
I found a site with an guide to add custom tags to html, the
I've managed to implement a great listview that I found here http://www.learn-android.com/2011/11/22/lots-of-lists-custom-adapter/comment-page-1/ but I
I'm using an HTML sanitizing whitelist code found here: http://refactormycode.com/codes/333-sanitize-html I needed to add
I have found a comment in a Gemfile: # ruby-debug19 is currently broken in
Found this while reading the Neo4j manual, specifically here , I found the sentence:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.