LE:私の説明スキルがかなり悪いと分かりましたので、私はすぐに被験者にします;CMSMSのURL書き直し
私は最近、CMSMS(CMS Made Simple)のウェブサイトビルドのカスタマイズを意味するプロジェクトを受け取りました。ウェブサイトのバージョンは1.11.2です。私は、URLの書き換えに対処するためにApacheとmod_rewriteを使用しています。 私はURL書き換えに関連する小さな問題を解決しようとしてきましたが、それを越えることはできません。
ウェブサイトには、ブログ用のモジュール、CGBlogがインストールされています。 ブログの内容を表示するには、ページ(およびそのページのテンプレート)が必要ですが、すべての投稿を流出させる場所はテンプレートではありません。基本的には、一般的なカテゴリ/アーカイブページです。 こうして私は、「ブログ」というURLの「ブログ」というページを作成しました。 これまでのところ、ブログを考慮していないので、example.com/blogのようなものがあります。
ブログには、すべての投稿の前に接頭辞を追加するオプションがあります。だから私はexample.com/any_prefix_here/title-of-postのようなものを作ることができます。また、ブログの投稿内では、アーカイブ/カテゴリページの呼び出し方法については考慮されません。 このプレフィックスオプションを使用して、URLを同じように見せています。例:example.com/blog、example.com/blog(adfixとして追加された記事)/ post-of-the-postの記事内にある場合
問題は、「ブログ」というブログのページの名前を保存しようとすると、私はexample.com/blogとしてアクセスできないか、403を禁止することになります。私がexample.com/anything/blogからアクセスするとうまくいきます。私がページの名前をblog2にすると、example.com/blog2としてアクセスできます。私は言葉として、「ブログ」との取引が何であるか把握できません。また、禁止されている403をバイパスする方法もわかりません。
私はさらに何とか.htaccess経由で書き直そうとしましたが、成功しませんでした。
これは現時点での私のhtaccessです。
# Attempt to override some php settings, these settings may be helpful on some hosts if your
# default configuration does not meet CMS's minimum requirements, and your host
# has given your account appropriate permissions
#php_value upload_max_filesize "10M"
#php_value session_save_path "tmp/cache"
#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off
# (this is important, so uncomment if your host permit)
Options -Indexes
ServerSignature Off
Options +FollowSymLinks
# To prevent E_STRICT problems with PHP 5.3+ you can uncomment the following lines
# Note: These settings should only be enabled for production sites!
#php_flag display_startup_errors 0
#php_flag display_errors 0
#php_flag html_errors 0
#php_value docref_root 0
#php_value docref_ext 0
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
# redirects /index.php?page=asfd to /asdf
RewriteCond %{THE_REQUEST} /index\.php\?page=([^\s&]+) [NC]
RewriteRule^/%1? [R=302,L,NE]
# redirects /index.php/asfd to /asdf
RewriteCond %{THE_REQUEST} /index\.php/([^?\s]+)\s [NC]
RewriteRule^/%1 [R=302,L,NE]
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA,L]
RewriteCond %{HTTP_HOST} ^connsys.ro
RewriteRule (.*) http://www.connsys.ro/$1 [R=301,L]
</IfModule>
<IfModule mod_header.c>
# Disable ETags
Header unset ETag
FileEtag None
</IfModule>
<IfModule mod_deflate.c>
# Compress css, plaintext, xml, gif, and images in transport.
AddOutputFilterByType DEFLATE text/css text/plain text/xml image/gif image/jpeg image/png
</IfModule>
<IfModule mod_expires.c>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
# Set expires tags on various files... so that the browser wont attempt to reload them.
ExpiresActive On
ExpiresDefault "access plus 1 year"
<IfModule mod_header.c>
# Setting cache control to public allowes proxy servers to cache the items too.
Header set Cache-Control "public"
</IfModule>
</FilesMatch>
</IfModule>
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>
<IfModule mod_headers.c>
# WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf|woff)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
</IfModule>
Tl; dr:ブログのページに問題または権限の問題を書き換えます。ページは「ブログ」と呼ばれ、スラッグ/ URLは「ブログ」です。私は403を禁止しているので、example.com/blogとしてブログにアクセスすることはできません。私がexample.com/anything/blogとしてブログにアクセスすると、それは動作します。ページの名前をblog2に変更すると、example.com/blog2として動作します。
この問題はどのように解決する必要がありますか?私が間違ったことを説明した場合に、私が間違っていたことをあなたがダウンボートして教えてくれないなら、私は感謝しています。
は
あなたが話しているURLは、ブラウザのアドレスバーに表示されているURLです。内部的に403を実際に送信しているものを正確に見つけ出す必要があります。 'index.php'の最上位で、他のコードよりも上に、次の行を追加します:' var_dump($ _ SERVER); URLの出力を記録します。彼らがすべて通り抜けていて、それらの間に(URLのパス部分を除いて)大きな違いがないなら、あなたの問題はあなたの '.htaccess'にある可能性は低いです。 – Walf
私がホームページにアクセスすると、var_dumpが得られます。私が/ブログにアクセスすると、私はまだ403禁止されたメッセージをサーバーから取得します。しかし、同じ問題を抱えているすべてのWebサーバーが3つまたは4つのWebサーバーに移動したため、サーバーの問題であるとは思えません。 – Darkkz
これは便利です。 index.phpファイルが決して要求を受け取っていないことが分かりました。すべてのサーバーが同じ問題を抱えているのであれば、おそらくあなたのコードでしょう。実際に何が起こっているかを見るために、いくつかの書き直しトレースを取得してください。 – Walf