<VirtualHost *:80>
php_admin_value open_basedir "/var/www/html/web/yourcharmstyle.com/htdocs/:/tmp/"
what the line meaning and do? thank you. why it add /:/tmp/ ? why it adds the line?
: is a separator here between two different paths -- the path to the docroot under /var/www, and the temporary directory /tmp.
Related
I want to search and replace specific value in a file, here is the content of the file
filename: /etc/httpd/conf/httpd.conf
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"
#
# Relax access to content within /var/www.
#
<Directory "/var/www">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
I want to replace DocumentRoot /var/www/html with DocumentRoot /var/www/html/centos
I tried the following
sudo sed -i "s#DocumentRoot /var/www/html#DocumentRoot /var/www/html/centos#g" /etc/httpd/conf/httpd.conf
This is not working, can someone point me to the right direction.
Thanks
The line you are trying to replace is:
DocumentRoot "/var/www/html"
It contains double-quotes. The sed command does not include the double-quotes. Try:
sudo sed -i 's#DocumentRoot "/var/www/html"#DocumentRoot "/var/www/html/centos"#g' /etc/httpd/conf/httpd.conf
Nevermind, i figured it out, i was missing double quotes, following command worked
sudo sed -i 's#DocumentRoot "/var/www/html"#DocumentRoot "/var/www/html/centos"#g' /etc/httpd/conf/httpd.conf
I currently have urls that look like: something.com/index.php?page=pagename
we would like to have it just be something.com/pagename
But still be able to access sub folders like something.com/admin/
Thanks in advance.
If you're using Apache, which I presume you are, you need to use the ReWrite Engine:
If you don't have one already, create or add to the .htaccess file stored in the root directory you're rewriting. So you if you want something.com/index.php?* to rewrite, then use put it in the folder where something.com is stored.
There, you need something like:
RewriteEngine On
RewriteRule ^([^/]*)$ /index.php?topic=$1 [QSA,L]
This regex takes the beginning of the input after "/", and uses that input as the variable $1.
Source: http://www.generateit.net/mod-rewrite/
You then change all your links to point to "/pagename"
You may also have to turn on the RewriteEngine module by uncommenting it in your httpd.conf file by finding the line like:
#LoadModule rewrite_module libexec/apache2/mod_rewrite.so
and deleting the leading #
More info: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
It is probarly pretty simple, but i cant find an solution.
How can i set the temp dir for file uploads.
What i want is change the location to www.mydomain.com/temporary
what i have tryd in .htaccess
php_value upload_tmp_dir "/home/mydomain.com/public_html/temporary/"
and without the last slash.
php_value upload_tmp_dir "/home/mydomain.com/public_html/temporary"
Does some one know if it is done by .htaccess and how?
According to the PHP manual, upload_tmp_dir can be changed only in php.in, not on a per-directory basis:
upload_tmp_dir NULL PHP_INI_SYSTEM
You'd have to have root access to the server to change that.
I have a directory with an .htaccess file having the setting IndexIgnore *. How can I set a subdirectory to not ignore anything, or to ignore the negation of everything, so as to override the parent directory's IndexIgnore? Like IndexIgnore ^*, only a working version thereof?
Simply add IndexIgnoreReset ON before the new IndexIgnore directive.
And then, to show everything in the sub folder use IndexIgnore "."
Check the documentation at:
IndexIgnoreReset
I don't think it will be possible because IndexIgnore list is always appended in the existing list (from parent .htaccess). There is now way to overwrite this directive AFAIK.
In <Directory> block you can add:
IndexIgnoreReset ON
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
This will override config for this specific <Directory>
How can I mask so all instances of www.oldsite.com are replaced with www.newsite.com
example:
I'd like to replace:
http://www.oldsite.com/home/b.jsp?id=9912&ln=115-991632
with www.newsite.com/home/b.jsp?id=9912&ln=115-991632
You can do this in Apache with the Redirect directive:
<VirtualHost *:80>
ServerName www.oldsite.com
Redirect permanent /home/ http://www.newsite.com/home/
</VirtualHost>
Well, if you only want to replace that page, you can create a .htaccess file with this content:
Redirect 301 /b.jsp?id=9912&ln=115-991632 http://www.newsite.com/home/b.jsp?id=9912&ln=115-991632
That's all I can think now. You should upload it to your /home directory.
If you want to do at the application level, just print a location header:
#!/bin/bash
echo 'Location: http://www.newsite.com'
To make it even better, you can place that cgi script at "home" (replace the directory with a script) and use the $PATH_INFO variable to do the correct thing
#!/bin/bash
echo 'Location: http://www.newsite.com/$PATH_INFO'