[英].htaccess working on windows however not working on apache2 in ubuntu
I am using the following htaccess code in XAMPP on windows it works fine. 我在Windows的XAMPP中使用以下htaccess代码,效果很好。 However the same code does not work on Ubuntu Apache2,
但是,相同的代码在Ubuntu Apache2上不起作用,
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ /?cmd=$1&caseSno=$2 [NC,L]
RewriteRule ^([^/\.]+)/?$ /?cmd=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/?$ /?cmd=$1 [NC,L]
without .htaccess file i am using my website links like this: 没有.htaccess文件,我正在使用我的网站链接,如下所示:
http://localhost/index.php?cmd=home
which working fine. 哪个工作正常。
but after using .htaccess file as the above code, i have changed my links to: 但是在将.htaccess文件用作上述代码后,我将链接更改为:
http://localhost/home
But in ubuntu these rules are not working. 但是在ubuntu中,这些规则不起作用。 any help will be appreciated.
任何帮助将不胜感激。
You can do the following: [write the following command on your terminal] 您可以执行以下操作:[在终端上编写以下命令]
sudo nano /etc/apache2/apache2.conf
Check your file if there is any # sign before the
AccessFilename .htaccess
remove # sign. 删除#号。
Go to the following and change None to All 转到以下并将“ 无”更改为“ 全部”
<directory /var/www/>
Options Indexes FollowSysLinks
AllowOeverride None
Require all granted
</directory>
Replace 更换
**AllowOverride None** to **AllowOverride All"
That's all you done. 这就是您所做的全部。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.