Redirect root URL - IIS 7 - windows

I have some forums installed on my site at http://ironnoob.com/forums.
My website lives in c:\IronNoob and my forums are installed in c:\IronNoob\forums
I want both "ironnoob.com" and "www.ironnoob.com" to do a server-side redirect to "ironnoob.com\forums".
I'm using IIS 7 and I'm new to setting up this stuff so I don't even know what to google for. I know I can do a client-side redirect with HTML, but I understand that the server-side redirect is nicer. I've figured out how to install the HttpRedirect module for IIS, but if I set up a redirect in the root folder of my site to my forums folder, I get a circular redirect error when visiting ironnoob.com.
HTTP Redirect Settings:
root directory selected in Connections pane of ISS
Check "Redirect requests to this destination"
destination = http://somesite.com/forums
Check "redirect all requests to the exact location"
Check "only redirect requests to content in this directory (not subdirectories)"
Status code: Permanent (301)
Why is it redirecting subdirectories when I told it not to? What is the right way to do this?

Instead of using the HTTP redirect module, you can use the URL rewrite one.
Run the inetmgr command and select your website root. Open the URL rewrite configuration:
Click on Add a rule on the right panel. Select a Blank rule in inbound rules:
From here you have to name your rule and select the Does not match the pattern option. You then have to set the Pattern (in this case, it means that a URL not starting with forums will trigger this rule):
The last step is to set up your redirect. You probably want to go with a 301 redirect as advised by Google:
Click Apply on the right panel and you should be good to go.
NOTE: If your Redirect URL doesn't match your Pattern you will be stuck in an infinite loop (you can test it by simply clicking the Test button will writing your Pattern).
Documentation for this module available here

Related

Magento migration from single store to multistore. Redirects

I have 1 website for now. Its URL is www.test.com, for example.
I want to create second website on the same domain adding store codes to URLs. So my URLs will be
www.test.com/first/
www.test.com/second/
But as I can see all my previous URLs will show 404 on their open. So if I open
www.test.com/product.html
it will show 404. It is not good because I loose my SEO.
How can I create redirects so if user opens
www.test.com/product.html
he will be automatically redirected to default website, like
www.test.com/first/product.html
Shall I have any issues with such redirects? (Like API will not work)
Or is it possible for URL
www.test.com/product.html
to show product from default website, if exists?
Magento has a very good system for SEO.
For Rewrite Management these are the steps:
1.Loginto Admin.
2.Move mouse over Catalog and you will find a drop down.
3 Select URL Rewrite management.
Catalog >> UrlRewrite Management
4.Then click on ADD URL Rewrite Button.
5.Then on next screen select custom from option provided
Create URL Rewrite : Select Custom
Now following important fields and values that should go:
Request Path (Old URL ) Target Path ( New URL ) redirect (Permanent 301).
Note : This approach will be good if you have few products but if you have too many product then some .htaccess rule is recommended.

magento category url,admin 404 error

I am a magento newbie.
I've observed that when I make an installation of magento by copying all contents of the extraction directly to localhost.... i.e (when app, media, skin, index.php etc all pasted directly in localhost) I am unable to access the admin by simply typing in localhost/admin.
Whereas I have to type in localhost/index.php/admin to get into the admin panel.
Also when i click on any category i have the same problem.
I have to append index.php/ before the category name to get the category link working.
Can anyone please tell me how to get them working.
Check your Base URL in the Admin Panel, go to System | Configuration | Web and make sure the Secure and Unsecure Base URL does not include the 'index.php' part.
If you do not have index.php in my secure or unsecure web configuration and this happening on front end and back end, try to enable url rewrites and see if that solves it. You need mod_rewrite enabled on your localhost.
What is your local server?

How can I change Joomla admin URL

By default Joomla admin URL is yoursitename/administrator. How can I change this for Joomla 1.5 so that it doesn't affect my modules and components or any other thing on the backend.
I don't think that would be a good idea, because some links to '/administator' in modules/components are hardcoded (static), so you better should use some of these plugins http://extensions.joomla.org/extensions/access-a-security/site-security/login-protection or just try something with .htaccess (ask for password, IP filtering etc...)
Install the jSecure Authentication plugin.
Every Joomla back-end has the same URL. If you install a security plugin, you can add a suffix to your back-end URL to make it look like this: http://www.yoursite.com/administrator?helloworld
If the URL is not entered with a correct suffix, the site will redirect to a 404 (not found) page. Change the suffix regularly.
I use the changeadmin component to kind of hide the admin url:
http://extensions.joomla.org/extensions/access-a-security/site-security/login-protection/14666
Here is a Simple Step(And it's not a correct method but it works for me),
Just Create a new folder in your root directory.
create index.php (or some other name) in that folder, and add the following code
$admin_cookie_code="2145446497812";
setcookie("JoomlaAdminSession",$admin_cookie_code,0,"/");
header("Location: ../administrator/index.php");
Then add the following code inside administrator/index.php . Please make sure to add this immediately after opening the PHP tag.
if($_COOKIE['JoomlaAdminSession']!= "159753987456321")
{
header('Location:../index.php');
}
Then try to access the administrator login by typing your root_joomla_address/new_folder_name. Then it will automatically redirect to your admin page. If you tried to access the default admin login page directly then it will redirect to the Joomla home page.
Hope this will works. I don't claim this a correct procedure. But if you looking to avoid a plugin, then this hack will help you.
with simple step you can restrict to access your administrator login page
Follow bellow steps:
before going through all steps first find your id address from this link www.whatismyip.com
Create a .htaccess file in administrator folder.
Now write following code in .htaccess file
<Limit GET POST> deny,allow deny from all allow from 192.168.0.1</Limit>
3.Now write your own ip instead of 192.168.0.1
4.Finally save the file and try to access your administrator page from your ip and different ip.
Hope it'll help. Thanks.

Routing a url to fetch content from another site

Environment: IIS 7.
I have a default site www.domain.com. Folder C:Inetpub/wwwroot/domain
There is subdomain www.subdomain.domain.com. Folder C:Inetpub/wwwroot/domain/subdomain.
Now, I have set up a new website at an external server, say www.newdomain.com. I cannot host www.newdomain.com on the same IIS server (as mentioned above) due to some constraints.
In this setup, how do I get www.subdomain.domain.com/blog to show all the content available on www.newdomain.com while preserving the URL as www.subdomain.domain.com/blog
How could this be achieved in IIS 7?
You would have to put the entire www.subdomain.domain.com on the other server. You can't put just the /blog path somewhere else.
How would any client know to go to that other server for /blog if the DNS for the subdomain points to the first server?
Alternatively, you could create blog.subdomain.domain.com for the blog server.
Possible approaches:
Host the new website as blog.domain.com with the actual content hosted on a different server (not the same IIS server as domain.com)
Set-up a ProxyPass on subdomain.domain.com/blog to the new website. I know how do to this on Apache (via mod_proxy and ProxyPass), but not sure how to do this with IIS. Probably ARR can help you.
I was finally able to do this by reverse proxy rewrite rule. For those who have similar trouble here is the solution:
Go to the site node hosting www.subdomain.domain.com and click rewrite rule. If ARR is not installed the IIS Manager will ask you to install it. After installing ARR close and reopen the IIS Manager.
Open the rewrite rule window. There will be a dialog asking to allow reverse proxy to servers outside your server farm, accept that. In the Inbound rule enter www.newdomain.com. In the from input of the Outbound rule enter www.newdomain.com and in the to input enter www.subdomain.domain.com. click apply changes.
This will route the entire www.subdomain.domain.com to newdomain.com. What you need is to route only the /blog link.
To do this go to rewrite rules and select the rewrite rule you just created. Click edit and in the match section in url input change (.asterix) to ^blog(.asterix). This will apply the rule to route only the /blog.
That all. test your routing in the browser, if everythings fine this should work.

why my IgnoreRoute does not work?

I want to prevent users access for my "~/Content/..." folder I wrote it as follow in "Global.asax.cs" and put this line of code at the top of every other routes
routes.IgnoreRoute("Content/{*pathInfo}");
but it does not work. in fact user can see every files in content folder by type the URL in browser.
am I missing something?
How did you figure out that it does not work? Give example.
You may have put it last in the Routing table. So try to move it up so that it gets added to the routing table first. The route collection is an ordered list of routes.
Also try this : Routes.IgnoreRoute("Content/");, but your version of ignore is also correct and it should work.
Lastly, I do not know what you mean when you say the user can see all the contents of the Content folder : Isn't that the point? User must be able to download files from the folder, and we usually just need MVC to ignore the requests from coming into the framework, and so that IIS can directly serve those files.
or did you mean Directory browsing is enabled, and you want to disable that : In that case go to IIS manager, and select your website and look for the Directory browsing option and disable it as shown here.
Your problem cannot be solved by routing constraints. There are 3 significant steps in processing request:
IIS got request.
IIS watch at filesystem and search for direct correspondence to file
If IIS didn't found any file - it gives request to ASP.NET MVC for processing.
So, you need to configure folder security to forbidden direct access to files, but allow access to application, as here.
But I don't recommend to secure folder, that should be shared. I don't believe that your site shouldn't have images to display :) If you have some secured content, you need to create another folder.

Resources