friendly-url

How to make url /username in codeigniter?

大兔子大兔子 提交于 2019-12-10 10:29:29
问题 I'm using codeigniter at the moment. I am currently able to view a persons profile by the using /user/profile/profile_id but I want to make it so that a user can just navigate to a profile using /username to make it simpler. How would I go about doing this I'm not sure where to start? class User extends CI_Controller{ public function index(){ if($this->session->userdata('is_logged_in')){ redirect('user/profile'); } } public function profile(){ $profile_id = $this->uri->segment(3); $ip = $this

Making strings URL Friendly (eg: convert Montréal to Montreal)

无人久伴 提交于 2019-12-10 10:08:45
问题 I am writing a web application that requires friendly urls, but I'm not sure how to deal with non 7bit ASCII characters. I don't want to replace accented characters with URL encoded entities either. Is there a C# method that allows this sort of conversion or do I need to actually map out every single case I want to handle? 回答1: I don't know how to do it in C#, but the magic words you want are "Unicode decomposition". There's a standard way to break down composed characters like "é", and then

How can I make URLs in Django similar to stackoverflow?

此生再无相见时 提交于 2019-12-09 18:11:55
问题 I'm creating a video site. I want my direct urls to a video to look like example.com/watch/this-is-a-slug-1 where 1 is the video id. I don't want the slug to matter though. example.com/watch/this-is-another-slug-1 should point to the same page. On SO, /questions/id is the only part of the url that matters. How can I do that? 回答1: Stack Overflow uses the form example.com/watch/1/this-is-a-slug which is easier to handle. You're opening a can of worms if you want the ID to be at the end of the

Friendly URLs with .htacces NOT working… and stackoverflow URLs style

荒凉一梦 提交于 2019-12-08 09:56:39
问题 I know this question has been asked a million of times here at stackoverflow, but I cant get it to work so I need someone who knows to finally resolve this problem! I want that when this is inserted in the URL: http://website.com/pelicula/0221889/ http://website.com/pelicula/0221889/posters/ It really goes to this: http://website.com/index.php?ctrl=pelicula&id=0160399 http://website.com/index.php?ctrl=pelicula&id=0160399&tab=posters This is how my .htacces file looks like: <IfModule mod

PHP+.htaccess: How to create URL like with ID+name of an article?

允我心安 提交于 2019-12-08 07:45:18
问题 I am thinking how to create the routing system like this: http://website.com/something/12345-my-new-car which says that in URL is placed the ID and slug name of an article. My current setup is the following (http://website.com/something/12345): RewriteRule ^something/(.*)$ index\.php?id=something&something_id=$1 [L,QSA] Now I would like to add the slug name behind the article ID. First idea - manually build it - something like: <a href="/something/<?php echo $id.'-'.$slug;?>">link</a> And

Regex to match a URL pattern for a htaccess file

南楼画角 提交于 2019-12-08 07:14:54
问题 I'm really struggling with this regex. We're launching a new version of our "groups" feature, but need to support all the old groups at the same URL. Luckily, these two features have different url patterns, so this should be easy? Right? Old: domain.com/group/$groupname New: domain.com/group/$groupid/$groupname The current regex I was using in the regex to redirect old groups to the old script was: RewriteRule ^(group/([^0-9/].*))$ /old_group.php/$1 [L,QSA] It was working great until a group

How to create dynamic/friendly URLs using PHP?

[亡魂溺海] 提交于 2019-12-08 06:46:20
问题 Can anyone explain how to create friendly URLs? I mean URLs like http://store.steampowered.com/app/22600/ that doesn't have any pages like index.php visible. 回答1: If you only have cpanel use .htaccess. If that doesn't work, you are left with parsing the url in php with a link like this: http://server.com/router.php/search You can do that with something like this. <? list($junk,$url) = explode("router.php",$_SERVER['REQUEST_URI']); $paths = explode("/", $url); if ($paths[0] == 'search') {

How to specify a SEO friendly url like twitter www.twitter.com/<name> using YII framework

為{幸葍}努か 提交于 2019-12-08 04:49:58
问题 I am currently using the Yii framework, and I would like to know if anyone has any clue on how to setup a SEO friendly url like www.twitter.com/ automatically in Yii? I know how to do so this manually in the config/main.php but I would like to be able to dynamically generate it. I have been able to do it in Grails as well. In Yii, what I know of is that you need to have another parameter like www.twitter.com/l/, but I do not want that parameter, anyone can share? Thanks. 回答1: Edit the config

Friendly Urls in DotNetNuke - Troubleshooting

旧时模样 提交于 2019-12-08 04:00:07
问题 In DNN, I'm using Host Settings -> Friendly Url Settings to try and make a page url SEO-friendly. But I keep getting an error and I don't know why. Current URL format: http://localhost/dnn/Admin/MyPage.aspx?title=news-article-name-written-here Desired URL format: http://localhost/dnn/Admin/MyPage/news-article-name-written-here "Friendly Url Settings" rule: MATCH: .*/MyPage/(.*) REPLACE WITH: ~/Admin/MyPage.aspx?title=$1 Error: Server Error in Application "DEFAULT WEB SITE/DNN" Internet

When is it OK to intentionally obfuscate URLs?

泪湿孤枕 提交于 2019-12-08 02:04:20
问题 Having friendly URLs is generally a good thing. However, there are sometimes when it seems like a bad idea. What is your rule of thumb? For instance, consider a situation where I want to show a Registration Success page. I want all of the underlying logic to be the same. However, depending on how they registered, I may want to display a different message for someone who registered under a certain type of role. Here are a few, off-the-cuff examples of "hackable" (as described in link) URLs: