Apache mode rewrite module with. htaccess file

Source: Internet
Author: User
Tags manual writing

Under Windows, we typically use the administrator account, so enabling these two is simple:

Found in the Apache installation directory]/conf/httpd.conf


#LoadModule Rewrite_module modules/mod_rewrite.so


, remove the previous annotation symbol #. If this line is not in use, add it. and verify that the Modules folder in the Apache installation directory has
Mod_rewrite.so


This file. This will enable the


Mod Rewrite
Function.


In


[Apache installation directory]/conf/httpd.conf
Found in


Options followsymlinks allowoverride None order Deny,allow deny

Put
AllowOverride None
"Change"
AllowOverride All
, so that all folders are supported. htaccess, or enabled for the specified folder. htaccess, you can


[Apache installation directory]/conf/httpd.conf
Added in

Options Indexes followsymlinks allowoverride All order Allow,deny allow to all this approach is typically configured with a virtual host, so most of the configuration code will be written Into
[Apache installation directory]/conf/extra/httpd-vhost.conf


, this is more clear and easy to manage.

After you restart Apache, it's OK.


After completing the appeal procedure, WordPress will use the link settings in the permalink in WordPress, in addition to the default settings, and the htaccess can be generated directly in its installation directory.

Mac OS X
Typically not used in Mac OS X
Root
Account, but through
Sudo
To obtain
Root
Related permissions.

In general, we put the Web site files in a personal directory, such as
~/sites
, which involves the right management of Mac OS, which is a lot more complicated than Windows.

Run sudo vi/etc/apache2/httpd.conf at the terminal, find
#LoadModule Rewrite_module modules/mod_rewrite.so
, remove the previous annotation symbol #.


Run
sudo vi/etc/apache2/extra/httpd-vhost.conf
Join
Options Indexes followsymlinks multiviews allowoverride All order Allow,deny allow to all
~/sites
can support
. htaccess

Run
sudo vi/private/etc/apache2/users/[user name].conf
, put the
AllowOverride None
Change into
AllowOverride All
。 It should be noted that the previous version of Mac OS X, the path may be
/private/etc/httpd/users/[User name].conf

In the directory you want to create a new. htaccess, and modify its permissions to 777, here is still the use of WordPress fixed link as an example.
CD ~/sites/wordpresstouch. Htaccesschmod 777. htaccess permissions for new files are by default
644
Pass
Ls-l. htaccess
You can see that the program is not automatically written to. htaccess, which is safe, but requires manual writing.

Restart Apache after exiting:
sudo apachectl restart

Once you have finished this setup, you can use the fixed link feature of WordPress. It should be noted that if. htaccess is copied directly from Windows, the log may appear
Without matching section
The error. The simple solution is to create a new file and copy the paste again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.