How to write apache RewriteRule
PHP中文网
PHP中文网 2017-05-16 17:03:35
0
3
508

Tomcat has a project topic, which is accessed by default at localhost:8080/topic and is now bound to the domain name topic.luger.me. The config file of apache is written like this

<VirtualHost 127.0.0.1> DirectoryIndex /topic/index.jsp ServerName topic.luger.me Options FollowSymLinks rewriteengine on </VirtualHost>
When accessing, you can still access topic.luger.me/topic. How to write RewriteRule rules so that they can be accessed when
topic.luger.me
I have always been wrong when writing this ^(.*) /topic/$1
I can't access it all the time. What's wrong?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
曾经蜡笔没有小新

You can directly DocumentRoot 指定到topic 路径下,DirectoryIndex /topic/index.jsp

<VirtualHost *:8080>
     ServerName topic.luger.me
     DocumentRoot "/var/www/topic"
     SetEnv APPLICATION_ENV "development"
     <Directory "/var/www/topic">
         DirectoryIndex index.jsp
         AllowOverride All
         Order deny,allow
         Allow from all
     </Directory>
</VirtualHost>
为情所困

DocumentRoot can’t point directly to the topic? Equivalent to creating a new vhost

習慣沉默

Do you want to access topic.luger.me and map it to localhost:8080/topic?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!