我在我的系统上安装了WAMPSERVER。在htdocs文件夹中,我有我的项目文件夹,名为“在线商店”。
因此,为了访问我的项目,我编写了
http://localhost/online-store我想要所有的请求
http://locahost/online-store/products/2 or http://localhost/online-store/products/ 被重定向到api.php。我已经为此编写了htaccess代码,但它说
/online-store/products url was not found on the system.我正在重写htaccess,使其成为restful。下面是我的HTACCESS代码。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)$ api.php?request=$1 [QSA,NC,L]
</IfModule>发布于 2013-10-16 14:34:30
确保将此代码放在htdocs/online-store/.htaccess中
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /online-store/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ api.php?request=$1 [QSA,L]
</IfModule>发布于 2013-10-16 14:39:12
您需要更改httpd.conf中的代码
wampdir/bin/apache/apache2.x.x./conf/httpd.conf
<FilesMatch "^\.ht">
Order allow,deny
Allow from all
Satisfy All
</FilesMatch>https://stackoverflow.com/questions/19406164
复制相似问题