.htaccess Generator
Upgrowly's free .htaccess Generator builds a safe file for cPanel hosting that forces https, picks www or non-www and adds caching, with every rule explained.
- Free
- No sign-up
- Runs in your browser
If your website runs on ordinary shared hosting โ most cPanel plans in India โ a small file called .htaccess controls how the server behaves. It can force the secure https:// version, pick www or non-www, make pages load faster with compression and caching, and show a friendly page when something is missing. Tick what you want and get a combined file with a plain explanation of every rule, each wrapped so a missing server feature cannot crash your site.
Your workspace
Fill in the details above, then press the button to see your result.
Guide
How to use it
- 1Download a backup copy of your current .htaccess from your hosting File Manager first.
- 2Tick the options you want. If you choose www or non-www, type your domain name.
- 3Read the explanation list under the result so you know what each rule will do.
- 4Add the rules to the top of your existing .htaccess in the main folder of your site (usually public_html), keeping anything WordPress or your platform already put there.
- 5Open your site in a private browser window and click through a few pages. If anything shows an error, put the backup back.
What the results mean
- .htaccess
- A settings file read by Apache web servers, which most shared hosting uses. It sits in your website's main folder. The dot at the start means it is hidden, so turn on "show hidden files" in File Manager.
- Force HTTPS
- Sends anyone who opens the old http:// address to the secure https:// one. Browsers mark http pages as "Not secure", and Google prefers https.
- www or non-www
- sharmadental.in and www.sharmadental.in are separate addresses to Google. Choosing one and redirecting the other stops your ranking being split between them.
- Compression and browser caching
- Compression shrinks pages before sending them, and caching tells visitors' phones to keep images and styles instead of downloading them again. Both make pages load noticeably faster on mobile data.
- Directory listing
- Without an index page, some servers show a list of every file in a folder to anyone who asks. Blocking it stops strangers browsing your uploads and backup files.
Common questions
My site broke after I added the .htaccess. What do I do?
Put your backup copy back straight away, or rename the new file to htaccess-broken so the server ignores it. A 500 error almost always means one rule is not supported by your host โ add the blocks back one at a time to find it.
Does this work on WordPress?
Yes, if your host uses Apache. Keep the block between # BEGIN WordPress and # END WordPress exactly as it is, and put these rules above it. Skip the trailing-slash and extension options โ WordPress handles those itself.
My host uses Nginx or LiteSpeed. Will this work?
LiteSpeed reads .htaccess files, so yes. Nginx ignores them completely; those rules have to go in the server settings, which usually means asking your host or developer. Cloudflare can also force HTTPS for you from its dashboard.
Why is the downloaded file called htaccess.txt?
Many computers hide or refuse files whose names start with a dot, so the download uses a safe name. After uploading it to your hosting, rename it to .htaccess โ with the dot and without .txt.
