简体   繁体   English

使用.htaccess文件,并使用带有根目录的子目录在PHP和XAMPP中重写URL

[英]with .htaccess file using sub-directory with root to re-write url in PHP and XAMPP

I am running XAMPP Server V. 3.2.1 on my windows. 我在Windows上运行XAMPP Server V. 3.2.1。 I have .htaccess file having the following code: 我有具有以下代码的.htaccess文件:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ /?cmd=$1&caseSno=$2 [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/?$ /?cmd=$1 [NC,L]

It working fine for me with two parameters in url and can rewrite my 它在url中有两个参数对我来说工作正常,并且可以重写我的

?cmd=page_name&id=34

like this 像这样

localhost/home/34

Now, i am trying to access my other pages which are situated in subdirectory. 现在,我正在尝试访问位于子目录中的其他页面。 structure of my directory is here: 我的目录结构在这里:

Please view the following image for directory structure

在此处输入图片说明

Please help me in this i am beginner with .htaccess 请帮助我,我是.htaccess的初学者

Thanks in advance 提前致谢

Place this rule inside /court_Admin/courtUsers/.htaccess : 将此规则放在/court_Admin/courtUsers/.htaccess

RewriteEngine On
RewriteBase /court_Admin/courtUsers/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/?$ ?cmd=$1 [QSA,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM