dongshi9407 2015-06-22 12:12
浏览 92
已采纳

Apache2.4重写

I have a UCP for my SAMP server, what worked fine with Apache2.2, but now we would like to move onto Ubuntu 14.04 with latest version of PHP and Apache.

But since sites-available using new method (.conf sites) somewhy our UCP not works.

Website: http://ucp.classrpg.net/

Problem, when you click to any link its redirect to a php file, which has been rewrited to .web file in .htaccess file.

RewriteEngine on 
# anything that contains a dot without a colon should be left alone
#RewriteRule ^[^:]*\. - [L]
# anything that contains a slash without a colon should be left alone
#RewriteRule ^[^:]*\/ - [L]
# redirect to main page
#RewriteRule ^/*$ /fooldal.php [L,QSA]
# anything else is to be treated as a title
#RewriteRule ^(.+)$ /data/$1 [L,QSA]
RewriteRule (.+).see(\?[.+?])?$ $1.php$2
RewriteRule (.+).web(\?[.+?])?$ $1.php$2

RewriteCond %{HTTP_HOST} ^(www\.)?kliens\.
RewriteRule (.*) http://ucp.classrpg.net/kliens.web [L]

AddDefaultCharset utf-8

#php_value display_errors 1

php_value upload_max_filesize 10M
php_value post_max_size 10M
php_value memory_limit 15M

AddType application/exe .lnk

Options -Indexes

ErrorDocument 404 /404.php
IndexIgnore *

<Files 403.shtml>
order allow,deny
allow from all
</Files>

<filesmatch "\.ori">
deny from all
</filesmatch>
Allow from 127.0.0.1
Allow from ::1
deny from 89.132.170.28
deny from 84.2.181.10
deny from 84.3.218.168
deny from 85.67.242.26

My ucp.conf file:

    <VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    ServerName ucp.classrpg.net

    ServerAdmin sqpp15@gmail.com
    DocumentRoot /var/www/usercp
        ReWriteEngine On
        <Directory /var/www/usercp/>
        Options All
        AllowOverride None
        Require all granted
        </Directory>
    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
  • 写回答

1条回答 默认 最新

  • donglao7947 2015-06-22 17:25
    关注

    It's not working because you don't have the use of .htaccess file enabled in your ucp.conf file.

    This

    AllowOverride None
    

    Needs to be changed to this

    AllowOverride All
    

    After the change restart apache. Let me know how you come out.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥15 python天天向上类似问题,但没有清零
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 C#调用python代码(python带有库)
  • ¥15 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?