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 8748895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:36:09+00:00 2026-06-13T12:36:09+00:00

I am developing a web page using Yii framework, I want to do url

  • 0

I am developing a web page using Yii framework, I want to do url management like facebook.
This is my url http://www.mywebpage.com/user/profile/id/10 but i dont want to show this url like this, i would like to show like this http://www.mywebpage.com/yogi can i do it in Yii? please anyone help me.

  • 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-06-13T12:36:10+00:00Added an answer on June 13, 2026 at 12:36 pm

    Check this article out to get started:
    http://yiitutorials.net/easy/easy-url-rewriting-with-yii

    You will bascially be storing the users custom URL in the database. So an example URL would be http://example.com/user/userurl

    In your main config you could set up a rule like:

    user/<customurl:.+> => 'user/view' //second part is the controller/action
    

    That rule defines that a URL with ‘http://example.com/user/’, the part after the slash can be accessed by a GET variable with the name ‘customurl’. You can then access the users custom URL like so:

    $_GET['customurl'];
    

    And query the user record something like so:

    $user = User::model()->find("customurl = '".$_GET['customurl']."'");
    

    As mentioned below, here is an example from a real website. In this example the URL looks like so: http://website.com/blog/{post_title}/{post_id}

    So the rule for this would be something like:

    london-blog/<post_title:.+>/<post_url:.+> => 'blog/viewpost' 
    

    So in our blog controller, we have an action called viewpost (see above how the rule is pointing to this controller/action?), which would look something like:

    public function actionViewpost(){
        $blogpost = Blog::model()->find("post_title = '".$_GET['post_title']."'");
        ...
    }
    

    So any URL that has the format london-blog/some_value/some_value will point to the controller action as specified in the config. You can then access the some_value parts using the variable names defined in the config (the bits in the < :.+>)

    Hope that helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a web page in which I'm using Twitter's Bootstrap Framework and their
I'm developing a web page using django and I want to add some javascript
I'm developing web-application, in this I want to add all months values on the
I am developing a web page using Dojo mobile v1.5.1. Below is the sample
I'm developing on asp.net using infragistics controls. I have develop a web page where
I am using PHP and Zend Framwwork for developing web apps, and i want
I'm developing a web page for a customer using the Silverlight application for dynamic
I am using the GWT for developing my web application and would like to
I am developing a web page for iPhones and iPod Touch's. I am using
Using aspnet, c# 3.5, developing in vs2008. Using IE7. I have a web page

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.