Topics Map > Communication and Collaboration > cPanel Web Hosting
cPanel, How to restrict access to your website to campus IP spaces
We've modified the cPanel web server configuration to make it easy to restrict access to your website. You can use the aliases we have provided to allow only people who are using computers on the particular network you choose to access your website.
To restrict your entire website, you will need to create a file called .htaccess in your public_html folder. You may already have a .htaccess file with code in it for Wordpress or Drupal if you have those installed. You can add the restriction code to the top of the .htaccess file if it already exists.
To create or edit the .htaccess file:
- Login to cPanel at https://web.illinois.edu.
- In the Commonly Used Features section of your dashboard, click on "File Manager".
- Make sure "Show Hidden Files (dotfiles)" is checked in the settings. Settings are found in the gear in the upper right.
- Click on the public_html and search for a file called .htaccess (note it starts with a period).
- If there is a .htaccess file, right click on the file and choose "Code Edit" on the menu. If there is no .htaccess file, create one by clicking on the +File menu item. Name the file .htaccess and make sure it is in the public_html folder.
- Right click on the file and click on "Edit" on the menu. (Alternatively, you can click on the icon for the .htaccess file and then click on the "Edit" icon at the top of the page.)
- A dialogue box may appear asking you about encoding. Just click on the "Edit" button to continue. The editor will open in a new window or tab.
Add the following lines to the file and then save the file.
The first 2 lines can't be changed. The third line indicates which IP space users you would like to access your account. The options are:
- UIUC Campus IP Addresses: uiuc-ip
- UIUC Administration IP Addresses: ua-ip
- NCSA IP Addresses: ncsa-ip
- University of Illinois - Springfield: uis-ip
- University of Illinois - Chicago: uic-ip