Tag Info

New answers tagged

1

@Cragmuer If all you want to do is host two different directories with separate user authentication, just add another <location> directive to your site config. I will assume that you have your ports.conf file setup correctly but I'll include a sample anyway. An example configuration would look like something like this: /etc/apache2/sites-available ...


3

A sitemap does not usually help get pages indexed. See The Sitemap Paradox. To get pages indexed: You need to link to each page from some other page or preferably multiple other pages. Include enough unique content on each profile that Google doesn't view the pages as duplicate. Provide a good landing page experience for anybody coming to the page ...


9

Sitemaps can be dynamic just like web pages. Just have a PHP script grab those names from the database and make a loop to echo out the XML for each one. Also, make sure you output the proper content type for your XML. That's it. The code below is a basic script for generating a dynamic XML sitemap. Please not this is only an example intended to point you, ...


1

Send all request (ServerAlias *.*.example.com) to a php file. And redirect where you want : $url=$_SERVER['HTTP_HOST']; $subdomains=explode('.', $url); $subdomains[0] : first subdomain $subdomains[0] : second subdomain ... You can redirect with header('Location: '.$URL);


2

To restrict the use of foo.bar.sites.example.com you have to place another VirtualHost above the existing one: <VirtualHost *:80> ServerName foo.bar.sites.example.com ServerAlias *.*.sites.example.com # .... </VirtualHost> Now you can block or redirect the access. However it's important that you place it above the other VirtualHost ...


7

This feature of Apache is known as "MultiViews" and it is handled by the content negotiation module: ...if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and ...


0

You did it the right way. Apache always takes the first VirtualHost if multiple entries match. For more information about Virtual Host Matching look at the official documentation: http://httpd.apache.org/docs/2.4/vhosts/details.html


0

RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !="" RewriteCond %{THE_REQUEST} ^[A-Z]+\s//+(.*)\sHTTP/[0-9.]+$ [OR] RewriteCond %{THE_REQUEST} ^[A-Z]+\s(.*/)/+\sHTTP/[0-9.]+$ RewriteRule .* http://%{HTTP_HOST}/%1 [R=301,L]


1

I hear that you can use a UCC certificate for multiple hostnames on multiple domains, but I haven't found anyone that will issue one with wildcards (I'd love to be proven wrong on that). Each wildcard certificate can only be used for one level of subdomains. You will have to purchase another wildcard certificate for each subdomain where you want ...


4

You can easily split your http.conf file up into multiple files. Debian based systems (such as Ubuntu) come configured that way by default. To make that happen you can include lines like this in your main conf file: IncludeOptional sites-enabled/*.conf Then you can put each of your site's virtual host files into a separate file like ...


4

It seems to me that you are doing things the hard way. Your httpd.conf file should not be large and there should only be one .htaccess file per site. As well, you are under the impression that .htaccess files are inefficient which is not really the case. Using config files requires the Apache server to be restarted in order for the configuration change to ...


4

What webserver are you running on? Nginx To remove www in nginx do the following. if ($host = 'www.example.com' ) { rewrite ^/(.*)$ http://example.com/$1 permanent; } That will strip the www. To force https: rewrite ^ https://$server_name$request_uri? permanent; Along those lines. Apache Force https: RewriteEngine On RewriteCond %{HTTPS} ...


0

Any time you redirect you are telling the browser to change the URL as it appears to the user. There are three approaches you could take for this problem. Serve both domains out of the same folder. This will mean that both domains have the same (duplicate) content. This solution works when both domains are served from the same server. You just need ...


0

I suspect that your rule isn't firing because it is at the end of your file. It comes after some of your other rules that are marked as "Last" rules with the [L] flag. Just moving the rule up to the top of the file should help. You could also combine it into a single rule by making the condition into this: RewriteCond %{QUERY_STRING} ...


0

The only way that the CSS and JS would be loaded from an IP address is if the HTML code specifies that. You will need to change your HTML code from: <link rel="stylesheet" type="text/css" href="http://192.168.10.10/css/default.css"> to a relative link: <link rel="stylesheet" type="text/css" href="/css/default.css">


2

Unfortunately it is not possible to disable or change the access logging configuration from within cPanel, or using .htaccess files or any other tricks - this can only be done with server administration privileges, not a single cPanel user privileges. Greater control over the logging would be a great feature to add into cPanel, though I can't personally ...


2

If you wish to disable the access logging, you will need access to httpd.conf file. This is possible only if you have root privileges. I won't be possible to edit these values with cPanel access.


1

If you're using Apache webserver you might use: # Turn on redirection module in case not already on RewriteEngine On # If requested file doesn't exist RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f # and the requested file is /scripts/script.php RewriteCond %{REQUEST_FILENAME} ="/scripts/script.php" # then use the script made available to all users ...


1

I wouldn't recommend using HTML meta tags to manage redirects. Go into your root directory, find the .htaccess file and add this to the top. # This allows you to redirect your entire website to any other domain Redirect 301 / http://siteB.com/ You may have to edit your settings to view that file because most programs hide the .htaccess file by default. ...


1

I think the problem with your rewrite rule is the OR flag. That flag usually means that there is a second rewrite condition coming. You only have one condition. Here is a site that provides a similar rule for blocking BaiduSpider with slightly different syntax: RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^Baiduspider.* [NC] RewriteRule .* - [F]


1

You can try blocking specific IP addresses in your .htaccess file. You can find the ranges here. In robots.txt you can also add the following User-agent: Baiduspider User-agent: baiduspider User-agent: Baiduspider+ User-agent: Baiduspider-video User-agent: Baiduspider-image Disallow: / Also, if you use caching plugins or CDN, make sure to clear all your ...


2

After a little digging and playing around with this, I've managed to figure it out and now have a working scenario for mod_pagespeed to only work on specific domains (vhosts) on the same server. My configuration is based on a CentOs 6 build Apache 2 that runs Parallels Plesk Panel. Create a separate pagespeed conf file and store it in a location that won't ...


1

Adding this line to your virtual host seems to work: php_value engine off <Directory "C:/xampp/htdocs/(path_to_directory)/dirname"> php_value engine off # other options </Directory> On Debian, the file would be located in the folder /etc/apache2/sites-available/


6

PHP scripts are not typically handled by the CGI module. They are usually handled by a separate PHP module with its own configuration options. This page has a few examples of syntax that should do the job for you. I expect that they would work either in your conf file or in .htaccess. Try: <Directory ...



Top 50 recent answers are included