PDA

Zobacz pełną wersję : Przekierowanie w htaccess



Chomiczycho
11-07-2011, 07:18
Witam,
chcę zrobić przekierowanie w .htaccess w joomla z index.php na stronę główną. Robiłem już przeróżne kombinacje ale ciągle pojawia się komunikat o pętli przekierowań lub - tak jak w poniższym zapisie - przekierowuje z każdej podstrony na stronę główną. Sądzę, że coś się gryzie w .htaccess bo raczej niemożliwe, aby żadna z komend, które znalazłem w sieci nie działała. Będę wdzięczny za pomoc.


# mod_rewrite in use

RewriteEngine On
RewriteCond %{HTTP_HOST} ^strona.pl(.*) [NC]
RewriteRule ^(.*)$ http://www.strona.pl/$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^\/index.php$
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*)$ http://www.strona.pl/ [R=301,L]


########## 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
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode data within the URL
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a ********** tag in URL
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%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})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
########## End - Rewrite rules to block out some common exploits


########## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
########## End - Custom redirects


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

# RewriteBase /


########## Begin - Joomla! core SEF Section
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
RewriteCond %{HTTP_HOST} !^strona\.pl$
RewriteCond %{HTTP_HOST} !^www\.strona\.pl$
RewriteCond %{REQUEST_URI} !^/404$
RewriteRule .* /404 [L]
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} (/[^.]*|\.(php|html?|feed|pdf|raw))$ [NC]
RewriteCond %{REQUEST_URI} !^/404$
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
########## End - Joomla! core SEF Section

zwiastun
11-07-2011, 10:24
Przekierowanie z index.php na stronę główną?
Czyli co chcesz zrobić i po co?

Chomiczycho
11-07-2011, 11:58
chciałbym, aby przekierowywało z www.strona.pl/index.php na www.strona.pl

wojsmol
11-07-2011, 23:43
Witam
Spróbuj tak
RewriteCond %{THE_REQUEST} !^POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteCond %{SERVER_PORT}>s ^(443>(s)|[0-9]+>s)$
RewriteRule ^index\.php$ http%2://strona.pl/ [R=301,L]Powyższy kod kochodzi z http://docs.joomla.org/Htaccess_examples_%28security%29.
Pozdrawiam

Chomiczycho
12-07-2011, 09:57
Wielkie dzięki !!! Teraz działa jak należy.