【发布时间】:2014-11-14 06:00:52
【问题描述】:
我在重写 URL 时需要帮助。这是给定的
Site URL: http://example.com:8000/myapp
当前的 htaccess
Allow from localhost
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
我的网站在
/var/www/htdocs/myapp
虚拟主机配置
<VirtualHost *:8000>
DocumentRoot "/var/www/htdocs"
ServerName example.com
ErrorLog "/var/log/apache2/custom/a_local_error_log"
CustomLog "/var/log/apache2/custom/a_local_access_log" common
<Directory "/var/www/htdocs">
Options Indexes FollowSymLinks
Require all granted
Order allow,deny
Allow from all
AllowOverride All
</Directory>
</VirtualHost>
问题是我的资产与应用程序位于同一文件夹中,但包含资产的代码是绝对的。示例:
/_js/jquery.js
/_js/myjs.js
是否可以改写成:
/_js/myqpp/jquery.js
/_js/myapp/myjs.js
谢谢!
【问题讨论】:
-
所以你希望 /var/www/htdocs/_js/myapp/jquery.js 指向 /var/www/htdocs/_js/jquery.js?还是反过来?
标签: php apache .htaccess url-rewriting