Directory-level configuration file found mostly on Apache web servers
2
votes
1answer
137 views
What are the most commonly used and basic Apache htaccess redirects?
This question is here so we can offer users who are looking for information on how to make one or more common or basic redirects in Apache using the htaccess file. All future questions pertaining to ...
5
votes
2answers
2k views
.htaccess directory to subdomain
I have been trying to make a subdomain from a directory (made by .htaccess) to be used as the main page starting like http://domain.com/sub/2/3/4.html and turning into ...
2
votes
3answers
2k views
Subfolder won't permenantly redirect to subdomain
Right now I have the following code to redirect all non-www URLs to www URLs:
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
Besides that redirection, ...
5
votes
3answers
10k views
How to remove trailing slashes from URL with .htaccess?
The situation
Across the entire domain, we'd like the URLs to hide file extensions and remove trailing slashes, independent of the domain name itself (as in, works on any domain).
Sample of our ...
14
votes
4answers
451 views
Removing non-www support
I'm not an advocate of the no-www movement. I like the www because it adds as a buffer to distinguish between our public and private/static sites.
The problem is that with one of our sites, our ...
10
votes
1answer
259 views
301 redirects for all except me
i want to my site down for an hour and i was using
order Deny,Allow
Deny from all
Allow from my.ip.add.ress
but i dont like the default error page, is there a 301 redirct where i can redirect ...
4
votes
1answer
711 views
Redirect from SSL HTTPS to HTTP (NO SSL)
Many of my visitors have bookmarked my site already with https://mydomain.com. Under the bad advice of a programmer I have put my whole site (Joomla) using SSL.
I do not sell anything or provide any ...
2
votes
1answer
105 views
.htaccess Redirect Old Threads
I have moved to mybb to vanilla and want to redirect old threads to the new format, so the indexed threads on google aren't lost.
The old format is
showthread.php?tid=3003
Whereas the new ...
0
votes
1answer
150 views
Stop searches showing tld domain sites appearing as subdirectory of main holding site domain?
I'm not sure if this is a problem specific to how my hosting is structured or not.
Let's say the main domain for my account is maindomain.com (for purpose of discussion)
I am building other sites, ...
10
votes
2answers
2k views
Is it better to have an ErrorDocument 404 redirect back to the homepage or a standard 404 error page?
We run an ecommerce site that was setup by a third party ecommerce software provider, basic shop with product pages, basket and checkout.
The third party vendor set up the htaccess file so that if a ...
6
votes
3answers
765 views
.htaccess permanent redirect to www
I have a WordPress installation that is not redirecting URLs not starting with www.
Example: http:// example.com/dir/ doesn't send to http:// www.example.com/dir/ instead goes to http:// example.com/
...
2
votes
2answers
1k views
Use .htaccess to rewrite requests for a PNG as a PHP GET variable
I'm REALLY bad with .htaccess files, and reading through the existing questions on SO only confuse me more (mainly because they're all situation-specific and don't exactly apply to my situation at ...
2
votes
2answers
5k views
Redirect/Rewrite Subdomain to Subfolder
I'm trying to redirect a subdomain to a subfolder e.g. forums.domain.com to www.domain.com/forums
Note that I started the forums in the subfolder format but worried that members might mistakenly try ...
2
votes
1answer
322 views
Trigger IP ban based on request of given file?
I run a website where "x.php" was known to have vulnerabilities. The vulnerability has been fixed and I don't have "x.php" on my site anymore.
As such with major public vulnerabilities, it seems ...
0
votes
2answers
1k views
.htaccess and browser caching
I ran across these suggested htaccess edits. Is this a good practice? Is this something I should implement on my wordpress site?:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType ...
0
votes
1answer
85 views
I need a little help with .htaccess rewrite
I need a little help with .htaccess file I have songs, singers and albums links I want to rewrite.
I all ready rewrote the links and they are like this:
the links for the songs is like this:
...
4
votes
2answers
79 views
Restrict access to directories hosting different sites
My hosting provider requires that my primary domain (let's call it domainX.com) points to my public_html root. I also own several other domains (let's call them domainY.com and domainZ.com) that are ...
5
votes
5answers
5k views
How to Remove Extensions From, and Force the Trailing Slash at the End of URLs?
Example of current file structure:
example.com/foo.php
example.com/bar.html
example.com/directory/
example.com/directory/foo.php
example.com/directory/bar.html
...
2
votes
9answers
4k views
Need to Stop Bots from Killing my Webserver
I am having EXTREME bot problems on the some of my websites within my hosting account. The bots utilize over 98% of my CPU resources and 99% of my bandwidth for my entire hosting account. These bots ...
4
votes
1answer
614 views
How do I setup authentication on a specific folder using .htaccess?
I have a folder that I want to host files privately on my webserver.
How do I go about making it password protected using .htaccess?
Note: Nothing monolithic, I want something that is simple/easy so ...
3
votes
6answers
506 views
SEO - which URL's are the best?
I'm using .htaccess with RewriteRule to create SEO-friendly URL's. However, I have a few questions about this:
First of all, I noticed many websites end their URL's with .html (or another ...
3
votes
4answers
226 views
1
vote
2answers
2k views
.htaccess redirect to subfolder in different domain, maintaining old domain in the URL
Redirect has been widely discussed and most problems solved, so I am sorry for opening yet another post about this, but none of the codes I am trying work.
I have a WordPress site hosted in ...
0
votes
2answers
229 views
htaccess and htpasswd trouble
This is the first time that I have ever tried working with .htpasswd and .htaccess files, so please point out my childish works.
I have my apache document root set to /www/ on my debian server. ...
0
votes
1answer
121 views
Switch to https
I'm looking to use an .htaccess file to use mod_rewrite to switch the protocol from http:// to https:// when someone hits my website.
For instance, once someone goes to:
http://www.mywebsite.com/
...
5
votes
1answer
1k views
.htaccess rule to redirect from 404 to search results
When a user (or a bot) request on non existing page, I want to redirect him to the search results. I prefere to do it with the .htaccess file using something like:
ErrorDocument 404 ...
4
votes
1answer
363 views
How can redirect pages from old core PHP site to new Joomla site?
We have our old site into core PHP and we have developed it again into Joomla 1.5 last year (because of some limitations we have to build it into 1.5). Now the problem is the URL of sites changed as ...
3
votes
1answer
640 views
Will adding “www.” to my domain setting in Google Analytics impact already collected data?
I have a profile in Google Analytics (GA) that has been collecting data for a year. The domain setting in GA is "http://example.com". The site, however, will redirect any non-www request, to ...
3
votes
2answers
407 views
RewriteRule not working for certain URLs
There are a few domains pointing towards the same server, and of course I need them all redirect to only one of them.
Redirects work, but only for certain URLs.
What works: http://www.domain.com, ...
3
votes
1answer
883 views
Can I enable GZIP on Godaddy?
One of my sites lives on GoDaddy's bottom-of-the-line cheap hosting, I have the correct code in my .htaccess file, but it's not compressing because mod_deflate is not loaded.
How do I enable that?
...
2
votes
3answers
497 views
Subdomains vs folders, for multi account/users application
So, for a multi user web app, what is better:
http://username.domain.com
Or
http://domain.com/username
I would like to get feedback about security, scalability and maintenance specifically, app ...
1
vote
2answers
567 views
Make a custom Apache handler (for multiple PHP versions)
I've successfully installed PHP 5.2 and it runs as CGI.
(5.3 is my default running on mod, or as the phpinfo says "Server API: Apache 2.0 Handler")
Ultimately I want to put something like ...
1
vote
1answer
1k views
Restrict direct folder access via .htaccess except via specific links
I want to restrict access to a folder on my server so that visitors may only access the contents (a web application) via links in the same domain. Can I do this using .htaccess? To be clear, I simply ...
1
vote
1answer
233 views
Gzip compress offline?
I've configured my site to serve compressed content by putting this line in .htaccess
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/javascript ...
0
votes
1answer
357 views
Force www. on multi domain site and retain http or https
I am using CakePHP which already contains an .htaccess file that looks like:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) ...