2012-03-29 10 views
0

JoomlaのURLの問題(コンポーネントの競合)を避けるため、スラッシュの後ろにダッシュを挿入する必要があります:D例URL "... blog/-icleicle-name"私が今必要とするのは、 "/ - "を "/"に書き換えることです。私はrouter.phpを使ってそれを行う方法を見つけるのにかなりの時間を費やしましたが、成功しませんでした。今私は助けを求める。誰かがhtaccessやrouter.phpでそれをする方法を教えてもらえますか?
ありがとうございます。JoomlaのURL文字をhtaccessまたはrouter.phpで書き換えます

私は私のhtaccessで推奨ルールを挿入しようとした場所です。

##################################################### 
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE 
# 
# The line just below this section: 'Options +FollowSymLinks' may cause problems 
# with some server configurations. It is required for use of mod_rewrite, but may already 
# be set by your server administrator in a way that dissallows changing it in 
# your .htaccess file. If using it causes your server to error out, comment it out (add # to 
# beginning of line), reload your site in your browser and test your sef url's. If they work, 
# it has been set by your server administrator and you do not need it set here. 
# 
##################################################### 

## Can be commented out if causes errors, see notes above. 
Options +FollowSymLinks 

# 
# mod_rewrite in use 
/********** TRYED HERE ********/ 
RewriteCond %{HTTP_HOST} ^www\.mysite\.com [NC] 
RewriteRule ^(.*)$ http://mysite.com/$1 [L,R=301] 
/********** TRYED HERE ********/ 
RewriteEngine On 
/********** TRYED HERE ********/ 

########## Begin - Rewrite rules to block out some common exploits 
## If you experience problems on your site block out the operations listed below 
## This attempts to block the most common type of exploit `attempts` to Joomla! 
# 
## Deny access to extension xml files (uncomment out to activate) 
#<Files ~ "\.xml$"> 
#Order allow,deny 
#Deny from all 
#Satisfy all 
#</Files> 

## End of deny access to extension xml files 
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR] 
# Block out any script trying to base64_encode crap to send via URL 
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR] 
# Block out any script that includes a <script> tag in URL 
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] 
# Block out any script trying to set a PHP GLOBALS variable via URL 
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] 
# Block out any script trying to modify a _REQUEST variable via URL 
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) 
# Send all blocked request to homepage with 403 Forbidden error! 
RewriteRule ^(.*)$ index.php [F,L] 
# 
########## End - Rewrite rules to block out some common exploits 

# Uncomment following line if your webserver's URL 
# is not directly related to physical file paths. 
# Update Your Joomla! Directory (just/for root) 

RewriteBase/
/********** TRYED HERE ********/ 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ 
RewriteRule ^index\.php$ http://www.mysite.com/ [R=301,L] 
RewriteRule ^index\.html$ http://mysite.com/ [R=301,L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
/********** TRYED HERE ********/ 

#Check to see if browser can accept gzip files. 
ReWriteCond %{HTTP:accept-encoding} (gzip.*) 
#make sure there’s no trailing .gz on the url 
ReWriteCond %{REQUEST_FILENAME} !^.+gz$ 
#check to see if a .gz version of the file exists. 
RewriteCond %{REQUEST_FILENAME}gz -f 
#All conditions met so add .gz to URL filename (invisibly) 
RewriteRule ^(.+) $1gz [L] 
AddType “text/css;charset=UTF-8? .cssgz 
AddEncoding gzip .cssgz 
AddType “text/javascript;charset=UTF-8? .jsgz 
AddEncoding gzip .jsgz 

# Disable calls to user registration or password or username reset ("register", "remind", "reset") 
RewriteCond %{REQUEST_URI} /component/user/(remind|reset|register)(\.html)? [OR] 
RewriteCond %{QUERY_STRING} option=com_user&view=(remind|reset|register) 

# Send all blocked request to homepage with 403 Forbidden error! 
RewriteRule index\.php$ http://new.marioiliev.com/ [R=301,L] 

########## Begin - Joomla! core SEF Section 
# 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !^/index.php 
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC] 
RewriteRule (.*) index.php 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 
# 
########## End - Joomla! core SEF Section 

# Deny access to php, xml and ini files 
# within components and plugins directories 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteCond %{REQUEST_URI} \.php|\.ini|\.xml [NC] 
RewriteCond %{REQUEST_URI} \/components\/ [OR] 
RewriteCond %{REQUEST_URI} ^\/includes\/|^\/administrator\/includes\/ [OR] 
RewriteCond %{REQUEST_URI} \/language\/ [OR] 
RewriteCond %{REQUEST_URI} \/libraries\/ [OR] 
RewriteCond %{REQUEST_URI} \/modules\/ [OR] 
RewriteCond %{REQUEST_URI} \/plugins\/ [OR] 
RewriteCond %{REQUEST_URI} \/templates\/ [OR] 
RewriteCond %{REQUEST_URI} \/xmlrpc\/ 
RewriteRule ^(.*)$ index.php [R=404,L] 

# Prevent most common SQL-Injections 
RewriteCond %{query_string} concat.*\([NC,OR] 
RewriteCond %{query_string} union.*select.*\([NC,OR] 
RewriteCond %{query_string} union.*all.*select [NC] 
RewriteRule ^(.*)$ index.php [F,L] 

# Block most common hacking tools 
SetEnvIf user-agent "Indy Library" stayout=1 
SetEnvIf user-agent "libwww-perl" stayout=1 
SetEnvIf user-agent "Wget" stayout=1 
deny from env=stayout 
+0

あなたは '意味するか「/」を「/ - 」' ?ダッシュは 'blog /'の後にのみ出現するのですか? – TryHarder

+0

実際には "/ - "から "/"はいこれは "blog /"の後にのみ表示されます – memario

+0

申し訳ありませんが、スラッシュの後にダッシュを削除したいのですが、それは間違いありませんか? **例** 'blog/-articlename'は' blog/articlename'になります – TryHarder

答えて

0

これはあなたのために働く必要があります。

RewriteRule ^blog/-(.*) /blog/$1 [L] 
+0

これはすばらしく見えるかもしれませんが、多分私は何か間違ったことをしています。投稿を編集し、このルールを貼り付けようとした場所を示すために使用しているhtaccesを追加します。 – memario

関連する問題