Friday, April 25, 2014

Change Network Profile in Windows Server 2012

Open PowerShell

To view currently assigned profile, enter command below:

Get-NetConnectionProfile

Result:
------
Name             : Network
InterfaceAlias   : Ethernet 2
InterfaceIndex   : 16
NetworkCategory  : Public
IPv4Connectivity : Internet
IPv6Connectivity : LocalNetwork

To change to Private
---------------------

 Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private

or Public

Tuesday, March 25, 2014

Drupal migration to IIS 7, Fixing URL Redirection, 404 error for Drupal

After migrating Drupal site from Apache to IIS, there was an issue with URL Redirection and ended up in 404 error.

To fix the issue, import the .htaccess file to IIS. Below are the steps...

1) Make sure URL Redirection is installed on your server
2) Once you have the URL Rewrite module installed, the next step is to open the IIS Manager and browse to your Drupal website.
3) Double click the URL Rewrite icon to continue
4) You'll now enter the URL Rewrite module settings. All we'll be doing for this task is using the import function, so click on the import rules.
5) Next step is to select the mod_rewrite .htaccess file to import. To do this click on the browse button on the right hand side of the configuration file field.
6) Select your Drupal .htaccess file and then click the import button to import your rules.
7) Once the .htaccess file is imported click the apply link in the top right hand corner of the screen, and you'll be returned to the main URL Rewrite module screen. From here all you need to do is rename the module to something more descriptive (e.g. Drupal) and make sure the rule is enabled from the context menu using the right mouse button.

(Applying above things fixed my issue. Below are some more steps that I found in another blog)

----------------------------
The final two steps you'll need to do is modify the request filtering in IIS so that functions like multiple word search strings work properly without giving you a 404 error, and to manually force Drupal to use Clean URL's as when using Microsoft's URL Rewrite module the REQUEST_URI variable is not supported as it is when using ISAPI Rewrite 3 from Helicontech.

To modify the request filter in IIS 7 open you ApplicationHost.config file and search for the following;


Then add this before the closing ">" character;

allowDoubleEscaping="true"

Save this, and your IIS config is complete.

Next, open your Drupal settings.php file and place the following code on a new line.

$conf['clean_url'] = 1; // 1 enables, 0 clears clean_url

Once you save this you should be all set to use Drupal's clean URL feature on IIS 7 using the new Microsoft URL Rewrite module. Any comments or feedback on the article, please feel free to post a comment below. If you'd like any specific support for your environment, then please post a new thread in the forums.

Friday, August 23, 2013

Website Re-direction Methods, 301 Redirect

301 Redirect (Various Methods)

IIS Redirect

  • In internet services manager, right click on the file or folder you wish to redirect
  • Select the radio titled "a redirection to a URL".
  • Enter the redirection page
  • Check "The exact url entered above" and the "A permanent redirection for this resource"
  • Click on 'Apply'

ColdFusion Redirect

<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.new-url.com"> 


PHP Redirect

Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?> 


ASP Redirect

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.new-url.com/"
%> 


ASP .NET Redirect



JSP (Java) Redirect

<%
response.setStatus(301);
response.setHeader( "Location", "http://www.new-url.com/" );
response.setHeader( "Connection", "close" );
%> 


CGI PERL Redirect

$q = new CGI;
print $q->redirect("http://www.new-url.com/"); 


Ruby on Rails Redirect

def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.new-url.com/"
end 


Redirect Old domain to New domain using htaccess redirect

Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Please REPLACE www.newdomain.com in the above code with your actual domain name.
In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

Redirect to www using htaccess redirect

Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Please REPLACE domain.com and www.newdomain.com with your actual domain name.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

How to Redirect HTML

Please refer to section titled 'How to Redirect with htaccess', if your site is hosted on a Linux Server and 'IIS Redirect', if your site is hosted on a Windows Server.

WordPress, IIS 7, 7.5 : Download failed. Destination directory for file streaming does not exist or is not writable

WordPress issue on IIS 7.5

Download failed. Destination directory for file streaming does not exist or is not writable
========================================================================

Add this line of code anywhere in the root file: wp-config.php


/* Setup a temporary folder for uploading and updating */

define( 'WP_TEMP_DIR', ABSPATH . 'wp-content/tmp/') ;

Now create a new folder named “tmp” inside: /wp-content/ and update permissions for IIS users to 'modify' the folder.

Saturday, June 16, 2012

Reset Administrator Password in Windows Server 2008

- Boot from your Windows 2008 Installation CD
- Click 'Repair your Computer' option
- Follow through until you get the option 'Open the Command Prompt' -> Click it and open the Command Window
- Type in the following Command:

"Move C:\Windows\System32\Utilman.exe C:\Windows\System32\Utilman.exe.bak"

Now copy 'cmd.exe' and rename to 'Utilman.exe'. Here is the command for that:

COPY C:\Windows\System32\cmd.exe C:\Windows\System32\Utilman.exe

Now go ahead and 'Reboot' your PC

At the logon screen -> Click the 'Ease of access' icon

This will open a command prompt window where you can reset the 'Administrator' password

Commands for that below:

net user administrator *

Press Enter

Type in the new password and confirm it

Note: You won't see the password as you type it, but its there in the memory..

Once you log in to your PC normally, delete the 'Utilman.exe' file and rename 'Utilman.exe..bak' to exe..


:)

Wednesday, May 30, 2012

CODEIGNITER URL REWRITING ON IIS 7

Below configs helped me fixing issue with pages other than homepage which was giving a 404 error because of url rewrite issue.

Make sure URL Rewrite module is installed on IIS.

Open IIS Manager -> go to your site -> “URL Rewrite” so double-click it.

In the top-right click “Add Rule(s)”

Select “Blank Rule” under “Inbound Rules” and click OK.

Enter “Strip index.php” in the Rule Name text box.

Enter “^(.*)$” into the pattern text box.

Expand Conditions and add a rule each for “Is not a file” and “Is not a directory”
Under Actions, in the Rewrite URL text box enter “index.php/{R:1}” and untick “Append query string”
Click “Apply”

Edit your CI system/application/config/config.php file and set   $config[‘index_page’] = “”;

Good Luck :)

Wednesday, May 9, 2012

Custom Run Command


Create your own Run Command 
========================
Step 1: Go to “Start,” “Run,”  and type regedit.
Step 2: Navigate to the following:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Apps Path
Step 3: Create a new folder/key under Apps Path. (Right-Click Apps Path and click “New,” “Key.”)
Step 4: Title the new folder/key the name of the application, e.g. firefox.exe.
Step 5: Right-Click the default string value and click Modify.
Step 6: Change the value to the path of the executable you are attempting to run. E.g. C:\Program Files\Mozilla Firefox\firefox.exe.
Step 7: Create a new “String Value” by right-clicking under the default value  and select “New,” “String Value.” Name it Path and enter the value as the same path you previously entered.

Step 8: Done! Now, all you need to do is go to “Start,” “Run,” and type the name of your command!

(I haven't tested it yet, if u guys find any probs, pls comment)