redirection with htaccess - .htaccess

hi i have a website. in this i want to redirect on specific pages.if sobebody type http://xyz.com?a=4&b=5 in the url it should be redirect on http://xyz.com?a=10&b=22.
how can i do this.

I would use your backend script (php, ruby, asp.net) to perform the redirect. However possible in htaccess, you will be writing too many rules for the redirect cases.

It's possible to use the RewriteMap directive to do what you want: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
However, I have to admit that I found it quite complicated when I tried and ended up giving in and going for a PHP based solution as suggested by #Jared. I found it more flexible and suitable to the use-case I was implementing.

Related

Make Joomla 3.x routing prioritize redirects above article ids?

So I am upgrading an existing website(different CMS) to the Joomla 3.4.1 CMS, and I'm running into the following problem.
Because it's a replacement for an old website, I need to make 301 redirects to make sure no links appear broken.
The old website used url's like '/10/Terms_of_use.html', basically url's which start with numbers. This results in the situation where Joomla looks for an article with the corresponding article number instead of acting according to the redirect set in the redirect manager.
So how do I prioritize the redirects over the interpretation of the article id's? Thanks in advance.
Aha! I found a way to disable the article interpretation from the Joomla routing. It's described on http://developernote.com/2012/05/how-to-remove-id-from-url-in-joomla-2-5.
Now this solution is commonly described online on several websites, most of which leave out the last bit. This one offers the full solution though. Anyways, thanks internet.

www.mydomainname.com/support - to - support.mydomainname.com

I am just wondering how can I do this with my domain.
I have a support page on my website and access it like:
www.mydomainname.com/support
but I want to do it like
support.mydomainname.com
It might be a simple question with a very simple answer but I am having trouble and confusion regarding this.
Any help would be appreciated.
Thanks.
There are a myriad of ways to do this, the simplest being a simple 302 redirect on the page. Depending on your web server setup, you could also setup a .htaccess file to implement the redirect.

htaccess rewrite : subdomain?

I am thinking of rewriting my urls, for example:
http://www.latox.org/category.php?cat=action
would become
http://action.latox.org
Is this possible to do with .htaccess rewrite?
Is this wise to do? As opposed to http://www.latox.org/category/action
What do you suggest? How would I go about doing the sub-domain rewrite?
Regards
Your first choice will be a nightmare to manage. It means for each possible cat values, you will have to add something in your dns file. The second solution is a lot better and simpler. Plus it has the side benefits of making your google karma higher. When people always point to the same domain your karma is getting higher.
The rules are fairly simple.
RewriteEngine on
RewriteRule ^/category/(.*)$ /category.php?cat=$1 [L]

Is it possible to do friendly url (url rewriting) in classic asp?

I know how to create/implement friendly url in asp.net, but is it possible (and if so - how) to do it in classic asp?
if its impossible, how would google respond (SEO) to creating pages whos sole purpose is to redirect (on load) to a different page?
thanks!
Use a URL rewriter like IIRF or IsapiRewrite that ties into IIS and is processed before ASP/ASP.NET/PHP get the request.
If your classic ASP application runs on a IIS7 then I would totally suggest creating a web.config and using ASP.NET url rewriting feature. I use that for my projects and it works perfectly!
If it runs on an older IIS then ISAPIRewrite or IIRF. Nevertheless I would try as hard as possible to upgrade to IIS7 as it will make things so much easier.
You can also do it without a Rewrite Filter using a custom 404 page. In that you can use Server.Transfer or Server.Execute to redirect off to the correct page. Trouble is you loose your QueryString object doing it that way but it sort of works with a little love and cuddling.
If you want to avoid Server.Transfer et al you can also wrap all your templates in objects and included them all and just call a render function on the template you want to render, leads to big code over-head but its easily overcome by modern server brute force power!
In IIS 7 use Microsoft's own free URL Rewrite!
You need an ISAPI module. It's quite a bit more complex than URL rewriting in ASP.NET, so you can try a commercial rewriter like this one.
Or you can try the Ionic's Isapi Rewrite Filter, which is free, at http://www.codeplex.com/IIRF
IsapiRewrite, yes, I agree with that recommendation.
To answer your other question, Google won't care, just 301 redirect them. Make sure you don't have duplicate content, and don't even 302 redirect. If you 301 redirect, the Google should keep your PageRank concentrated on a single page. (This is what the SEO gurus at work tell me.)
ISAPI_Rewrite v3 will satisfy your needs. There a friendly manager and quite an easy syntax (well anyway if you encounter problems, you may address their support forum).

.htaccess or .htpasswd equivalent on IIS?

Does anyone know if there is an equivalent to .htaccess and .htpassword for IIS ? I am being asked to migrate an app to IIS that uses .htaccess to control access to sets of files in various URLs based on the contents of .htaccess files.
I did a google search and didn't turn up anything conclusive. Is there a general approach or tool that I need to purchase that provides this capability ?
For .htaccess rewrite:
http://learn.iis.net/page.aspx/557/translate-htaccess-content-to-iis-webconfig/
Or try aping .htaccess:
http://www.helicontech.com/ape/
There isn't a direct 1:1 equivalent.
You can password protect a folder or file using file system permissions. If you are using ASP.Net you can also use some of its built in functions to protect various urls.
If you are trying to port .htaccess files used for url rewriting, check out ISAPI Rewrite: http://www.isapirewrite.com/
I've never used it but Trilead, a free ISAPI filter which enables .htaccess based control, looks like what you want.
This is the documentation that you want:
http://msdn.microsoft.com/en-us/library/aa292114(VS.71).aspx
I guess the answer is, yes, there is an equivalent that will accomplish the same thing, integrated with Windows security.

Resources