2017-06-11 6 views
0

私は自分のウェブサイトhttp://tstspanama.com/をApacheサーバーにホストしています。これは、PHPフレームワークCodeigniterで作成されました。私はホームページだけを見ることができますが、他には何もない、リンクは機能しません。私はhttp://tstspanama.com/serviciosに行きたい場合はエラー404:私のウェブサイトのリンクが機能せず、インデックス(Codeigniterと.htaccessを使用)

、私が取得:

要求されたURL /serviciosが見つかりません

このサーバー上で見つかりませんでした

は誰でも方法のアイデアを持っていますこれを修正しますか?私はすべての重要なコードを添付します。アプリケーションの設定で

(/var/www/tsts/application/config/config.php)で私の.htaccessの

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteBase /tsts/ 
    RewriteCond $1 !^(index\.php|assets|images|css|js|robots\.txt) 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule ^(.*)$ index.php/$1 [QSA,L] 
</IfModule> 

<IfModule !mod_rewrite.c> 
    # If we don't have mod_rewrite installed, all 404's 
    # can be sent to index.php, and everything works as normal. 
    ErrorDocument 404 /index.php 
</IfModule> 

<ifModule mod_php5.c> 
    php_value default_charset utf-8 
</ifModule> 

php_flag display_startup_errors on 
php_flag display_errors on 
php_flag html_errors on 

$config['base_url']  = isset($_SERVER['REQUEST_URI']) && $_SERVER['HTTP_HOST'] != 'localhost' ? 'http://'.$_SERVER['HTTP_HOST'].'/' : 'http://www.tstspanama.com/'; 

$config['index_page'] = ''; 

$config['uri_protocol'] = 'AUTO'; 

の/ etc/apache2/sites-available/www.tstspanama.com

<VirtualHost *:80> 
    ServerName www.tstspanama.com 
    ServerAlias tstspanama.com 

    DocumentRoot /var/www/tsts 
    <Directory /> 
      Options FollowSymLinks 
      AllowOverride None 
    </Directory> 

    <Directory /var/www/tsts> 
      Options Indexes FollowSymLinks MultiViews 
      AllowOverride None 
      Order allow,deny 
      allow from all 
    </Directory> 

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 
    <Directory "/usr/lib/cgi-bin"> 
      AllowOverride None 
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
      Order allow,deny 
      Allow from all 
    </Directory> 

    ErrorLog /var/log/apache2/error.log 
    # Possible values include: debug, info, notice, warn, error, 
    # crit, alert, emerg. 
    LogLevel error 
    CustomLog /var/log/apache2/access.log combined 
    Alias /doc/ "/usr/share/doc/" 
    <Directory "/usr/share/doc/"> 
     Options Indexes MultiViews FollowSymLinks 
     AllowOverride None 
     Order deny,allow 
     Deny from all 
     Allow from 127.0.0.0/255.0.0.0 ::1/128 
    </Directory> 
</VirtualHost> 
+0

将来的には、エラーメッセージやコードの代わりに画像を投稿することはありません。このウェブサイトの検索エンジンはテキストのみを索引付けします。編集されました。 – Sparky

答えて

0

あなたがRewriteBaseを追加した場合、URLはそれを検討し、それを削除するか、/を使用します。

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteBase/
    RewriteCond $1 !^(index\.php|assets|images|css|js|robots\.txt) 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule ^(.*)$ index.php/$1 [QSA,L] 
</IfModule> 

<IfModule !mod_rewrite.c> 
    # If we don't have mod_rewrite installed, all 404's 
    # can be sent to index.php, and everything works as normal. 
    ErrorDocument 404 /index.php 
</IfModule> 

<ifModule mod_php5.c> 
    php_value default_charset utf-8 
</ifModule> 

php_flag display_startup_errors on 
php_flag display_errors on 
php_flag html_errors on 
+0

私は実際に 'RewriteBase/tsts /'として持っています。なぜ私はそれを変更する必要がありますか?私はこの動作の仕方をよく理解していません –

+0

** .htaccess **がindex.phpと同じディレクトリに存在する場合、それは必須ではありません。 'RewriteBase'はあなたのパスに接頭辞を追加します。言い換えれば、** http://tstspanama.com/servicios**をロードしようとしたときに 'RewriteBase/tsts /'がある場合、apacheは現在のディレクトリの '/ tsts /'フォルダからindex.phpを読み込みます。あなたはそれを試していますか? –

関連する問題