[英]RewriteRule on localhost
localhost, xampp, win 7 本地主机,xampp,赢7
site root folder is s02
, so all relevant files, including .htaccess
is under this folder. 站点根文件夹是s02
,因此所有相关文件(包括.htaccess
都在此文件夹下。
links like this work fine: 像这样的链接工作正常:
http://localhost/news/s02/view.php?art=160915142500&title=blue-sky
I want the following computed url 我想要以下计算的URL
http://localhost/articles/160915142500/blue-sky
.htaccess .htaccess
RewriteEngine on
RewriteBase /
RewriteRule ^articles/([0-9]+)/([a-zA-Z-_]*)$ view.php?art=$1&title=$2 [NC,L]
result - error 404 结果-错误404
httpd.conf httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
- uncommented LoadModule rewrite_module modules/mod_rewrite.so
注释
AllowOverride All
.htaccess (test) - this works: .htaccess(测试) -这有效:
RewriteEngine on
RewriteRule ^ http://example.com/? [L,R]
phpinfo(); phpinfo();
mod_rewrite
is under Loaded Modules
mod_rewrite
在“ Loaded Modules
Any help? 有什么帮助吗?
Try with below rule, we are telling apache that incoming uri is not a file or directory. 尝试以下规则,我们告诉apache传入的uri不是文件或目录。
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^articles/([0-9]+)/([a-zA-Z-_]*)$ /news/s02/view.php?art=$1&title=$2 [NC,L]
Place .htaccess
file into the root folder ie htdocs for xampp (I guess). 将.htaccess
文件放入根文件夹,即xampp的htdocs(我想)。 The .htaccess
file should be like this. .htaccess
文件应该是这样的。
RewriteEngine on
RewriteBase /
RewriteRule ^articles/([0-9]+)/([a-zA-Z-_]*)$ news/s02/view.php?art=$1&title=$2 [NC,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.