url-rewriting

rewrite url. asp.net c#

how to rewrite url string. in asp.net with c#.net. ...

URL Redirection and htaccess security - redirecting non-authenticated users off-site to a live server

We have a dev server that has managed to become indexed by Google. Page 2 of a relevant search on Google will throw up links to the dev server instead of the live one (with the same content.) However, we have now locked the dev server down behind IP address restrictions and htpasswd authentication, so any inbound traffic from google wil...

URL Rewriting in .Net MVC

Hi, I'm wondering what is the best way to handle URL in MVC. For ecemple, in my application I have a PageControlle so when I view any page of my website it goes to /website/Page/Index/3 or if it's home page it goes to /website/Page/home and all my link in my menu are build dynamicly with Html.ActionLink() and T4MVC so I don't get anythi...

IIS URL Rewrite RegExp to not match a directory

Have a IIS7 URL rewrite rule which uses friendly url so for example regEx is ([A-Za-z]+)/([A-Za-z]+) www.mysite.com/genetics/overview gets rewritten to www.mysite.com/genetics/default.aspx?a=overview Now I need to change the RegEx so it excludes the Content folder and any subdirectory in this folder. Been trying a few examples with ...

Should I switch to IIS7 URL rewriting?

I'm using Intelligencia url rewriting currently but have just leased an IIS 7.5 server to put my asp.net 3.5 site on. I installed the IIS URL rewriting module and was amazed at how easy it was to create rules. Creating rules with the Intelligencia url rewriter is complicated (at least for me). Are there any downsides to switching? I...

dashes vs underscores in URL

In URL rewriting, i am quite confused that should i use underscore (_) OR hyphen (-) to replace spaces. According to this and this, hyphen should be used. But wikipedia uses underscores like en.wikipedia.org/wiki/Computer_network_programming. so which should be used? ...

htaccess and no www

I am trying to redirect my whole site to non-www here is the htaccess code I am using # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress # no www RewriteEngine On RewriteCond %{HTTP_HO...

.htaccess mod_rewrite for nested folder structuring

Hello, I recently found an article online that told me about this: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2 [NC] Only thing that is driving me crazy right now is if I want to be able to have the 2nd directory or not. Like: RewriteRule ^mock-up/([^/]+)/([^/]+) /mock-up/index.php?page=$1&section=$2 [...

IIS URL Rewrite Module : Rewrite Appends QueryString

Hi There I have the following rewrite rule. <rule name="cheapbastardz.signupcode" stopProcessing="true"> <match url="^signup/code/([_0-9a-z-%=\+\$]*)$" /> <conditions> </conditions> <action type="Rewrite" url="Page.aspx?sc={R:1}" appendQueryString="false" /> </rule> Now when the user click on a buton where the p...

Right way for blog URLs

Hey everyone, I'm trying to do blog application and I want main page to have this URL: http://localhost/blog and posts to have URLs like this: http://localhost/blog/post-slug-name. So now I'm trying to understand how other actions should look like. Should it be something like this? http://localhost/blog/post-slug-name/edit (GET/POST) ...

[^.] causing headache in RewriteRule

I am struggling with a very basic regex problem in my .htaccess file that I hope someone may be able to shed some light on. The basic premise is that I would like to teach Apache to switch any .html extension into a .var extension. I had thought that the rule would be positively trivial: RewriteRule ^([^.]+)\.html$ $1.var But the [^...

Adding title to rails route

I have List objects which are shown like this: www.mysite.com/lists/123 Where 123 is the id of the list. What I would like to do is add the title of the list the url so it it more informative(for google or whatever). So I would like it to look like: www.mysite.com/lists/123/title-of-list-number-123 How do you go about adding to a u...

Will URL-Rewriting with IIS7 require code change?

Hi, I've got an ASP.NET application up and running on a server. I'd like to implement URL Rewriting, which will involve query strings. I've downloaded IIS Manager and am remotely connecting to the host server (running IIS 7). If I enable URL Rewriting and add all the relevant rules, will my source code require any changes? Or is it si...

iis7 url rewrite - optional querystring parameters

Hi, I'm using the iis7 URL Rewrite module and it's working fine, except for two things. Being new to this, I might be missing something obvious. 1) My URL gets converted from www.mysite.com/search.aspx?fName=John&sName=Smith to www.mysite.com/John/Smith. This works fine, but if I add a trailing / , a few images on the site disappear, w...

like twitter url with rewritecond????

I would like a simple help. I have a URL like this: /profile.php?id=<id>&name=<name>. My .htaccess file like this: RewriteRule ^profile/(.*)/(.*) profile.php?id=$1&name=$2 So I have a end URL like this: /profile/<id>/<name>. I can make /<id>. But how can I get a URL like /<name>? I can use the RewriteCond to make a conditional? I s...

fetching article from mysql using slug

Hi all, i am writing my own news article section on my site, and store each article in a mysql database. Each article has a unique id, a title, the main body and thanks to the jquery plugin, it's own url-friendly slug. However, I am not sure how on earth I go about fetching the article when linking to the slug. How do i get: www.site...

Should I use Url.Content() or ResolveUrl() in my MVC views?

When building code like this: <script type="text/javascript" src="<%=ResolveUrl("~/js/js.js")%>"></script> or <input type="image" src="<%=ResolveUrl("~/img/submit.png")%>" /> Should I use Url.Content or ResolveUrl()? What's the difference? ...

SEO URL Structure

Based on the following example URL structure: mysite.com/mypage.aspx?a=red&b=green&c=blue Pages in the application use ASP.net user controls and some of these controls build a query string. To prevent duplicate keys being created e.g. &pid=12&pid=10, I am researching methods of rewriting the URL: a) mysite.com/mypage.aspx/red/green/...

ReWrite RegEx, URL having at least one character.

I have the following RewriteRule: RewriteRule ^/people/([A-Za-z0-9\-\_]*)/?$ /people/people_details.cfm?person=$1 [I,L] ...it works great for forwarding my rule, but I want to make sure that the regex only picks it up if it has more than one character. So really, I need to have my regex... [A-Za-z0-9\-\_]+ ...have an additional r...

RegEx URL ReWrite match all in expression unless term exists.

I am currently rewriting a URL, however my RegEx expression is catching a directory I want to be ignored. The rewrite rule is ^people/([A-Za-z0-9\-\_]+)/?$ ...Which catches everything that matches. However, I would like to exclude a directory, People_Search, so for instance... /people/John_Smith ...will forward, but /people/Peop...