friendly-url

C# Byte[] to Url Friendly String

血红的双手。 提交于 2019-11-28 04:23:02
I'm working on a quick captcha generator for a simple site I'm putting together, and I'm hoping to pass an encrypted key in the url of the page. I could probably do this as a query string parameter easy enough, but I'm hoping not too (just because nothing else runs off the query string)... My encryption code produces a byte[], which is then transformed using Convert.ToBase64String(byte[]) into a string. This string, however, is still not quite url friendly, as it can contain things like '/' and '='. Does anyone know of a better function in the .NET framework to convert a byte array to a url

PHP .htaccess -> pretty url (in reverse)

自作多情 提交于 2019-11-27 20:55:57
I know how to make URL's rewrite, for example: www.example.com/index.php?id=1&cat=3 to www.example.com/1/3/ (or whatever). I know that. What I don't know is how on earth to change my whole links in all pages to link to pretty URL's. All my site's links are old fashion ( <a href="index.php?id=1&cat=2"> ) and there are many. I`m asking if someone has an idea or know how to automaticaly redirect to that pretty url if the user click on index.php?id=1. (Almost like this site Stackoverflow if you change title in the url). So my presumtions are... Use .htaccess to read the index.php?id=1&cat=2 to

How do I generate a Friendly URL in C#?

本小妞迷上赌 提交于 2019-11-27 17:24:27
How can I go about generating a Friendly URL in C#? Currently I simple replace spaces with an underscore, but how would I go about generating URL's like Stack Overflow? For example how can I convert: How do I generate a Friendly URL in C#? Into how-do-i-generate-a-friendly-url-in-C Konrad Rudolph There are several things that could be improved in Jeff's solution, though. if (String.IsNullOrEmpty(title)) return ""; IMHO, not the place to test this. If the function gets passed an empty string, something went seriously wrong anyway. Throw an error or don't react at all. // remove any leading or

Most effective way to code SEO friendly URLs?

亡梦爱人 提交于 2019-11-27 16:58:40
问题 I currently use .htaccess and PHP to parse URLs in the following way: URL : http://blah.com/article/123_this-that-and-the-other .htaccess : RewriteEngine On RewriteRule ^article/([0-9]+)_(.+)/?$ index.php?page=article&id=$1 [L] PHP $page = isset($_GET['page']) ? safeGET($_GET['page']) : null; $id = isset($_GET['id']) ? safeGET($_GET['id']) : null; if ($page=='article') { include 'article.php'; } elseif { ... } I've begun running into problems with the far-too-paranoid Mod_Security engine that

foo.com/alice vs. foo.com/users/alice

喜你入骨 提交于 2019-11-27 16:24:50
问题 It's of course nice to give users friendly URLs for their content on your site. But how best to do that? There are a lot of advantages to something like foo.com/users/alice, most importantly that you aren't cluttering up your root namespace. But I think simplicity for users trumps all that. A lot of big sites seem to agree (friendfeed, delicious, and flickr come to mind) and this question is about how to accomplish that on the server side. Let's assume the real URL for alice is foo.com

Rewrite all queries to not need the .php extension using a mod_rewrite RewriteRule

泪湿孤枕 提交于 2019-11-27 14:31:25
I'd like all queries like http://mysite.com/something/otherthing?foo=bar&x=y to be rewritten as http://mysite.com/something/otherthing.php?foo=bar&x=y In other words, just make the .php extension optional, universally. I would do it this way. Basically, if file doesn't exist, try adding .php to it. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ $1.php [QSA,L] If you can change the httpd.conf and what to, you can also put: ForceType application/x-httpd-php in the file as it will force all the paths called to be PHP files. I think this also works with

Regular expression - any text to URL friendly one

半腔热情 提交于 2019-11-27 14:02:57
问题 PHP regular expression script to remove anything that is not a alphabetical letter or number 0 to 9 and replace space to a hyphen - change to lowercase make sure there is only one hyphen - between words no -- or --- etc. For example: Example: The quick brown fox jumped Result: the-quick-brown-fox-jumped Example: The quick brown fox jumped! Result: the-quick-brown-fox-jumped Example: The quick brown fox - jumped! Result: the-quick-brown-fox-jumped Example: The quick ~`!@#$%^ &*()_+= -------

Customize FacesServlet <url-pattern> to get rid of .xhtml extension

混江龙づ霸主 提交于 2019-11-27 13:19:18
I have Login.xhtml and Home.xhtml . I configured the url pattern in web.xml as follows <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>Login.xhtml</welcome-file> </welcome-file-list> When I run the whole project, the login page URL is like this http://localhost:8080/fran/Login.xhtml , here fran is my project name.. However, I would like it to be http://localhost:8080/fran/Login/ instead of http://localhost:8080/fran/Login.xhtml . How can I achieve this? Is it possible to customize the <url

$_GET and URL Rewriting for PHP

▼魔方 西西 提交于 2019-11-27 11:46:34
问题 How does URL rewriting affect the $_GET parameter for PHP? Say I have a URL like http://example.com/index.php?p=contact and I use $_GET['p'] to tell index.php to serve the contact page. If I use a rewrite rule that converts the URL to http://example.com/contact , will $_GET['p'] still work as expected? If it does, could you elaborate on why it works? If not, what strategies could be used to solve the problem so that the page will work both with and without the rewrite? 回答1: Yes, that will

What makes a “friendly URL”?

不问归期 提交于 2019-11-27 10:16:13
I've read a great deal of discussion recently (both on this site and elsewhere) about "friendly URLs" but I'm not sure what exactly makes a URL "friendly" and why we really even care (up to a certain point). Illustration: The following is an example of a URL that would be held up by the majority of current web developers as "friendly": www.myblog.com/posts/123/this-is-the-name-of-my-blog-post Whereas this would be considered "unfriendly" (i.e. bad, Neanderthal, ignorant, stupid): www.myblog.com/posts.aspx?id=123 My questions: Doesn't the "friendly" URL contain duplicate identifying information