Directory-level configuration file found mostly on Apache web servers

learn more… | top users | synonyms (1)

1
vote
1answer
37 views

How Do I Remove A Subfolder Using Htaccess?

I am trying to remove /view from example.com/businesses/view so you can go to example.com/businesses and it works correctly. Here's what's in my htaccess already: DirectoryIndex index.php RewriteBase ...
1
vote
2answers
115 views

How to deny direct access to font files used in CSS?

I have a website that displays texts with unique, copyrighted fonts. I use a CSS file with "font-face" elements (see the example below) and I store the font files in a folder called "type". I would ...
1
vote
1answer
56 views

PHP webpages in sub-directory cannot be accessed

I've got a university club website at thing.uni.ac.uk/meow/foobar which also has the domain foobar.co.uk. I don't have access to the config. I set up this website using HTML/CSS/JS alone and it's been ...
2
votes
2answers
69 views

Need .htaccess mod_rewrite for serving static content from subdomain, but forcing www otherwise

I have a website where I currently force example.com visits to www.example.com, and it has an SSL certificate, so I also force HTTP to HTTPS. My SSL certificate covers example.com and www.example.com. ...
6
votes
1answer
143 views

.htaccess rewrite url leads to missing css

I am trying to make my url from this: www.domain.com/view.php?id=15 To ths: www.domain.com/watch/15 My code in htaccess is as follows: Options -Indexes Options +FollowSymlinks ...
3
votes
1answer
89 views

After rewriting URL page not found

I want to rewrite my current URL that is http://localhost/sitename/landing-page/?from=Algeria&to=Afghanistan&submit=Submit to http://localhost/sitename/removals-from-Algeria-to-Afghanistan ...
1
vote
0answers
40 views

Problem with http to https redirect

I have the following .htaccess file (in www.example.com/folder1/folder2) RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] to map any HTTP request ...
1
vote
0answers
61 views

URL masking to subdomain redirecting to subdomain

I am trying to change the URL of a Joomla site in browser my original URL is like example.com/marketsite/abc and I want to change it to abc.example.com/marketsite/abc I am using following code ...
9
votes
3answers
1k views

Can the files robots.txt and sitemap.xml be dynamic through an .htaccess redirect?

I have a multilanguage and multidomain site. It runs through a unique CMS installation (Drupal), so I have a single root directory. So if I have a static robots.txt, there I only can show the files ...
0
votes
1answer
48 views

fail2ban logs IP address trying to access server, enough?

I have fail2ban and logwatch set up. There are IP addresses that are banned > 20 times every day for trying to brute force (I assume) access the server. I have added these IP addresses to the ....
4
votes
2answers
364 views

redirecting https to http

RewriteEngine on RewriteCond %{SERVER_PORT} ^443$ RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301] # WordPress Defaults RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} ...
1
vote
2answers
65 views

Why are my Google Analytics pageviews and sessions down?

I am running a WordPress site. Up until October 1, the site had a blog running at the root level of the site. On that day, I moved all the blog files into a directory so the WordPress blog would be ...
4
votes
1answer
260 views

Too many redirects due to htaccess code

TL;DR: What does the following line of code do? Does it remove trailing slashes from a URL? RewriteRule ^(.*)/$ http://%{HTTP_HOST}/$1 [R=301,L] I inherited a Drupal site with little knowledge ...
0
votes
1answer
16 views

Redirect a set of dir to single page

Suppose I have example.com and removed 5 directories.They consist a lot of URL.Because I give penalty from google search engine, I decide to create a page and redirect (permanent 301) those to my page....
0
votes
0answers
17 views

Redirection rule not working in .htacces [duplicate]

I have added the following rule to .htaccess RewriteCond %{HTTP_HOST} !^example\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://www.example.com/$1 [R=301,NC,L] I ...
4
votes
1answer
573 views

redirecting openshift rhcloud domain to custom domain for SEO purposes

Openshift application url: example.rhcloud.com Custom domain: example.com I came across this link and added the redirection rule. However, I can not access example.rhcloud.com now. My custom domain ...
4
votes
1answer
315 views

Redirect and removing question mark on URL using htaccess

When I access my site using www.example.com/blog it redirects to example.com/?/blog. How can I remove the question mark, so that the redirection just goes to example.com/blog? My current .htaccess ...
1
vote
0answers
88 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
57 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
36 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
62 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
100 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
100 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
654 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 Error,...
1
vote
1answer
176 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
179 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
211 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/ http://www....
1
vote
0answers
40 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
129 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
244 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
26 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
42 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
59 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
229 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
42 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
127 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
245 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 ...
4
votes
3answers
2k 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
670 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]+)/?$ games....
0
votes
0answers
14 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
184 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
56 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: https://github.com/h5bp/server-configs-apache/blob/...
5
votes
2answers
214 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} [R=301,...
1
vote
1answer
257 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
39 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
32 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
50 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
53 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
186 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 ...