Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

1
vote
0answers
77 views

Random domain pointing to my domain

A random person has pointed their domain to my website. I don't have much experience with websites, but I know a bit. What can I put in .htaccess to give a 403 error if they try to access from a ...
0
votes
2answers
53 views

Non-www to www Redirects

I'm trying to redirect my main domain non-www to www but I have this error; my add on domain redirects like this: http://www.example.org/example.org/ How can I redirect my main domain without ...
2
votes
1answer
34 views

Conflicting mod_rewrite rules

The Background I run a university club website which has multiple domains, let's say meow.co.uk, foo.uni.ac.uk/bar/meow/ as two relevant cases. (When I upload files using an FTP client, it's the ...
2
votes
0answers
59 views

What strings do %{HTTP_HOST} and other mod_rewrite variables return? [closed]

If I have a htaccess file that has RewriteCond %{HTTP_HOST} in it, what is the HTTP_HOST? This is something I've been struggling to find out. To help me understand, could you tell me, in each example ...
1
vote
1answer
96 views

How to set up a rel=canonical in PHP?

I'm trying to add the rel=canonical tag to only one page. In order to add the tag, I need to add it to the part, in the mod_header.php file. This will add the same rel canonical tag to all the pages ...
4
votes
1answer
97 views

.htaccess rewrite when site has multiple domains

I run a university club website which has two three (update: I have recently discovered the third) domains, let's say www.meow.co.uk, foo.uni.ac.uk/bar/meow/ and uni.ac.uk/bar/meow. I'm using the ...
4
votes
2answers
495 views

htaccess ErrorDocument 500 not working

I have a site whose .htaccess file contains: ErrorDocument 404 /errors/404.html ErrorDocument 500 /errors/500.html The 404 redirect works just fine, but when I encounter a 500 Internal Server ...
1
vote
1answer
105 views

Only use HTTPS for main site and HTTP for subdomains

I have a few static files on a i. subdomain but I don't have an SSL certificate and for its use it doesn't need one, however when I try to access it - it redirects for https which throws up an error ...
4
votes
1answer
173 views

How do I tell a directory that all files inside should be treated as a PNG?

I have PNGs in which for instance they are named "5021" rather than "5021.png" and for some images it is fine and displays like a normal image but others download automatically; I was told by someone ...
1
vote
1answer
180 views

How to redirect the root of a directory in .htaccess without also redirecting all the contents?

I have two specific URL which are being redirected with 301 redirect in my .htaccess file like below: redirect 301 /old-url-1/ http://www.domain.com/new-url-3/ redirect 301 /old-url-2/ ...
1
vote
0answers
36 views

How to Exclude URL From PageSpeed Modification

I am currently working with the PageSpeed module and one of the URLs it is modifying I need to restrict. Here is the page I am looking at but it does not seem to have the solution for restricting the ...
0
votes
0answers
20 views

Seo-wise way to remove a portion of website [duplicate]

I have a website with 5000+ products driven from a MySQL database, so far so good. My links are friendly structured; http://www.example.com/brand/product/ About a year ago, I decide to add reviews ...
0
votes
1answer
88 views

Remove www and force https [duplicate]

This has been asked multiple times, but none of the answers have worked for me. I have just installed an SSL certificate and need to force https connections for all visitors. This site has a lot of ...
1
vote
2answers
217 views

htaccess ErrorDocument 404 not working

I am planning to replace WordPress on my site with custom HTML/CSS/JS, and I'm trying to check my .htaccess file will work. It is working, as I was able to change the directory index with it, but for ...
0
votes
1answer
24 views

Rewrite rule for url that's different than directory structure

We have a a site that has a url like such: http://www.example.com/sample Internally on the server the directory structure is like this: /site-specific/www.example.com/sample The htaccess looks ...
1
vote
2answers
35 views

Using .htaccess to get content from directory for sub-domain

I've read a tonne of questions on this and tried a few solutions, but I'm just not getting the results I want. I'm currently using: RewriteEngine on RewriteCond %{HTTP_HOST} ^cp\.example\.net ...
0
votes
0answers
56 views

htaccess www to non-www and non-SSL to SSL [duplicate]

I want to redirect all HTTP requests to HTTPS as well as redirect all www requests to non-www. The reason for this is that I want SSL to be forced and I am currently unable to support SSL on my www ...
2
votes
2answers
200 views

Rewrite rule to replace every %20 in the URL with an underscore

I would like my current URLs: http://example.com/files/528/Rabba%20Ho%20-%20Falak%20Shabir%20Song.html To look cleaner like this: http://example.com/files/528/Rabba_Ho_-_Falak_Shabir_Song.html ...
0
votes
2answers
41 views

How do i increase speed of my site by reduce time to fetch dns of my website? [closed]

My website "happyclothing.in" took 5 seconds to load. where it took 2 seconds to fetch the dns . How do i reduce it to 0 second.
3
votes
1answer
109 views

Stop Google from indexing parent folder URLs

Here is my problem: example.com/images folder and subfolders contain all of my images for example.com site and sub pages. Google is indexing those directories locations as URLs. For example. ...
2
votes
1answer
224 views

redirect various http domains to certain https domain via htaccess

I have a bunch of domain names with different TLDs. What I want is to point several domains to the "main"-domain which has a SSL cert (single domain). Like this: https://maindomain.com (main domain ...
3
votes
2answers
1k views

htaccess redirect non-www to www with SSL/HTTPS

I want a rewrite rule that redirects everything to https:// AND www. For example https://example.com should be going to https://www.example.com This is what I have: RewriteEngine On RewriteCond ...
1
vote
2answers
566 views

How to change my id and name in php url

How would I change the URL from from: example.com/games.php?id=27 to: website.com/games/271/game-name-here So far I have this in .htaccess: RewriteEngine on RewriteRule ^games/([0-9]+)/?$ ...
0
votes
0answers
13 views

HTTP to HTTPS Redirect, but make it cacheable redirect? [duplicate]

In an effort to speed up my small wordpress site. This was recommended to allow caching my redirects. Wordpress Settings has HTTPS for address. What are my options? Avoid landing page redirects ...
2
votes
1answer
170 views

.htaccess file not caching

I have read several guides for how to write the htaccess file for caching but with no success. I asume I wrote something wrong and need some help on finding what i did wrong. Here's my htaccess file: ...
1
vote
1answer
50 views

Apache .htaccess mod_rewrite: use of [NC]

I see tons of .htacces examples containing the [NC] flag (NoCase = case-insensitive) For example the famous h5bp page use the [NC] flag a lot: ...
5
votes
2answers
195 views

Redirect non-www to www : .htaccess without giving the domain name

To redirect non-www to www we often see this in .htaccess: RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteRule ^(.*) http://www.example.com/%{REQUEST_URI} ...
1
vote
1answer
166 views

How to do 301 redirect for complete URL?

I have a lot of URL, which can't be redirected, or, better, rewrited with mod_rewrite in .htaccess, so instead rewriting, I have created 301 redirects manually. It isn't too much records, about 40 ...
0
votes
0answers
38 views

Hosting htaccess redirect subdirectory to subdomain

I have simple hosting plan with domains included: Now I have the domain.com and seconddomain.com now I want to use all that domain and give them his own root directory. If I use the controle panel ...
1
vote
1answer
22 views

Why does Apache parse .htaccess if accessed through the main page and not through a VirtualHost?

I have two websites. One is hosted on /var/www (www.example.com) and the other is /var/www/test (test.example.com). The second is a VirtualHost. I wrote a .htaccess (I'm using it to mod_rewrite), put ...
2
votes
1answer
46 views

Making friendly URLs without making unfriendly URL accessible to anyone

As many know, one can make a friendly URL with mod_rewrite in their .htaccess file like so: RewriteRule ^category/(.*)$ /somescript.php?category=$1 [L] This works as long as somescript.php is ...
0
votes
1answer
47 views

Difference between redirect and rewrite in .htaccess (in relation to SEO and the canonical tag)

Okay so if I'm wanting to remove the extension of a URL but my canonical tags point to the url with the extension I can't use a 301 redirect without it negatively affecting SEO. Does the same go for ...
0
votes
1answer
162 views

Vanity URLs with .htaccess and PHP?

I need to create a vanity URL redirect using htaccess and PHP. My requirements are: If a user writes example.com/users/foobar The client will be redirected to for example: profile.php?user=foobar in ...
2
votes
1answer
104 views

Why does blocking IP addresses from China and Ukraine to fight spam also block some legitimate European visitors?

I'm getting hammered by spam requests. I allow guest comments that require pending and got over 20,000 of them in a very short space of time. 99% are from Ukraine or China. To bypass this I have used ...
2
votes
2answers
92 views

Leverage browser caching for WordPress images on media subdomain?

My website is built with WordPress and I'm using a combination of the plugins W3 Total Cache and Autoptimize to make my website faster. My settings seems to be correct and most optimisation efforts ...
1
vote
0answers
81 views

Parallels Plesk Apache dedicated server shared IP / A Address serving default page

My Website Works when you go to it, however Google Adwords is telling me that my site is redirecting/ not showing up properly to their bots. When you put the site into a website checker like GT ...
0
votes
1answer
19 views

Disable directory indexing for all directories using root htaccess

How to disable directory indexing for all directories using root htaccess? Using this line Options -Indexes only disable listing on directory where the htaccess put. I'm sure there's a lot of ...
2
votes
1answer
82 views

Wordpress https://example.com not redirecting to https://www.example.com htaccess

I'm using WordPress and moved to https recently. I've had some issues since with the domain not redirecting properly. Currently it works OK but https://example.com is not redirecting to ...
3
votes
2answers
801 views

redirect 204 with htaccess if url contain certain string

I get tons of url with "undefined" added at the end of url, consisting about 20% of my pageview. I tried to check the troubling script source and can't find it. Tried some solutions but none of them ...
0
votes
0answers
198 views

redirecting bots and crawlers to another but not human via htaccess

I would to apply this diagram via htaccess I tried a lots of codes but I failed every time so I need to redirecting bots and crawlers especially from facebook via htaccess regards
1
vote
3answers
270 views

htaccess , htpasswd and error 401

I have a problem with htpasswd. I get an error in error.log apache2 user admin: authentication failure for "/": Password Mismatch Content of my htaccess file: # Set Access Restrictions ...
2
votes
1answer
292 views

.htaccess not passing GET parameters

I have a .htaccess file that looks like this: RewriteEngine on RewriteRule ^login$ /login.php? [L,R=301] However when I do any get parameters such as /login?random=get&params=true they don't ...
1
vote
1answer
105 views

Restrict access to certain files but not when linked from my own website

I got a problem regarding setting my server settings so that my files can't be accessed from people linking directly to the files, but can when they click a link on my website to open the file. I ...
4
votes
2answers
113 views

Create redirect from url like www.example.us/?p=100&option=

I am switching CMS and have about 600 URLs that need to get redirected to the new scheme. The URL on the old site looks like the following on my test server: ...
0
votes
0answers
52 views

Friendly URLs with .htaccess

I'm have the following .htaccess: RewriteEngine on RewriteCond %{request_filename} -f RewriteRule ^(.*) $1 [L] RewriteRule ^(([^/]*)+)(/([^/]{0,32})(/.+)?)?$ index.php?a=$1&q=$3 [L] My ...
0
votes
1answer
105 views

How to use htaccess to redirect from www to non-www version of the site [duplicate]

I have a wordpress website mywebsite.net on the wwww version www.mywebsite.net wordpress doesn't load so want that if the user open the www version of my website is redirect to the non-wwww ...
0
votes
0answers
76 views

Sub-Domain Redirect Loop .htacess

OK so i am getting a redirect loop on subdomains only and i dont see the whats creating the loop This is a WordPress Multi-Site sub-domain installation and All plugins are disabled everything on the ...
1
vote
1answer
80 views

How to keep friendly URLs consistent?

I downloaded a site with a crawler script (HTTrack) and now have a few hundred HTML files that need to be edited and re-deployed. The original site ran on a combination of Drupal and a lesser known, ...
0
votes
0answers
50 views

How do I hide the install folder [webroot] while using a subdomain?

Wanted to try out a web install of Owncloud. For some reason or another Owncloud has a hard time masking its own install folder (the webroot) when using a subdomain defined via an A record and picked ...
1
vote
1answer
33 views

Moving site - make all links 301 on same tld

Customer had website in Joomla like this: www.example.com/home/ www.domainA.com/home/aboutus www.domainA.com/home/blog Not sure why it was made this way with /home as default. Anyway I moved the ...