如何删除" / web"从我的URL?

时间:2014-07-25 09:50:36

标签: php .htaccess crud silex

我正在使用crud-admin-generator(http://crud-admin-generator.com/)为我的网络应用程序生成一个快速后端,该应用程序基于silex框架。

我的应用结构是:

MyApp
  ->index.php
  ->some_other_files
  ->...
  ->admin (the crud-admin-generator git clone)
      ->gen
      ->src
      ->vendor
      ->web
         ->controllers
         ->resources
         ->views

1)当我访问管理员时,我目前需要使用http://localhost/MyApp/admin/web。我想删除/web部分。 我尝试在htaccess文件夹中创建自定义admin,其中包含:

<IfModule mod_rewrite.c>
    Options -MultiViews    
    RewriteEngine On
    RewriteBase /web
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [QSA,L]
</IfModule>

但我一直收到错误:The requested URL /web/index.php was not found on this server.

2)生成的管理面板使用了silex框架,是否有一种简单的方法可以让我使用doctrine组件或框架本身作为我的前端(admin文件夹之外的文件)?我是否需要手动更改所有生成的管理文件的路由路径?对不起,如果我听起来很困惑。

5 个答案:

答案 0 :(得分:3)

保持/MyApp/admin/.htaccess像这样:

<IfModule mod_rewrite.c>
    Options -MultiViews    
    RewriteEngine On
    RewriteBase /MyApp/admin/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^((?!web/).*)$ web/$1 [NC,L]
</IfModule>

答案 1 :(得分:1)

<IfModule mod_rewrite.c>
    Options -MultiViews    
    RewriteEngine On
    RewriteBase /mekaturk1/admin/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^((?!web/).*)$ web/$1 [NC,L,R]
</IfModule>

- &GT; web / $ 1 [NC,L,R]是重要的 R

答案 2 :(得分:0)

在电脑前花了几个小时甚至更长时间google for propper解决方案,最后我找到了适合我的那个:

第1步:启用Apache rewrite_module

第2步:编辑.htaccess文件,如下所示

Options -MultiViews


<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [QSA,L]
</IfModule>

我希望它有效。

答案 3 :(得分:0)

由于某种原因,解决这个问题会有所不同,就我而言,我使用此代码

2021-07-24T09:36:22,992 INFO  [http-nio-5555-exec-9] o.k.a.KeycloakDeployment: Loaded URLs from https://foo.baz.com/auth/realms/sso/.well-known/openid-configuration
2021-07-24T09:36:23,156 ERROR [http-nio-5555-exec-9] o.k.a.r.AdapterTokenVerifier: Didn't find publicKey for kid: a7GiJ8syCz3UYPMlVKmfWb9tfPYLxbz_j5xWOniokg8
2021-07-24T09:36:23,181 ERROR [http-nio-5555-exec-9] o.k.a.r.AdapterTokenVerifier: Didn't find publicKey for kid: a7GiJ8syCz3UYPMlVKmfWb9tfPYLxbz_j5xWOniokg8
2021-07-24T09:36:23,410 ERROR [http-nio-5555-exec-3] o.k.a.r.AdapterTokenVerifier: Didn't find publicKey for kid: a7GiJ8syCz3UYPMlVKmfWb9tfPYLxbz_j5xWOniokg8
2021-07-24T09:36:23,412 ERROR [http-nio-5555-exec-1] o.k.a.r.AdapterTokenVerifier: Didn't find publicKey for kid: a7GiJ8syCz3UYPMlVKmfWb9tfPYLxbz_j5xWOniokg8
2021-07-24T09:36:23,415 ERROR [http-nio-5555-exec-1] o.k.a.r.AdapterTokenVerifier: Didn't find publicKey for kid: a7GiJ8syCz3UYPMlVKmfWb9tfPYLxbz_j5xWOniokg8
2021-07-24T09:36:23,417 ERROR [http-nio-5555-exec-3] o.k.a.r.AdapterTokenVerifier: Didn't find publicKey for kid: a7GiJ8syCz3UYPMlVKmfWb9tfPYLxbz_j5xWOniokg8

对不起,我的英语太差了

答案 4 :(得分:-1)

尝试

RewriteRule ^(.*)/web$ /$1 [L,R=301]

这些应该从网址的末尾找到“web”这个词,我已经测试过了。

相关问题