PDA

Zobacz pełną wersję : przekierowanie index.php na domena.pl oraz domena.pl/strona-startowa na domena.pl



rynek25
18-07-2014, 16:07
Witam,

szukalem wszedzie i nie moge sobie poradzic, mam w google webmaster + w pliku httaccess ustawione aby adresy byly wyswietlane bez przedrostka www i tutaj nie ma problemu, natomiast chcialbym zrobic przekierowanie 301 aby adres domena.pl/index.php oraz domena.pl/strona-startowa wskazywały na domena.pl... walcze z tym 2 dni i niestety mimo roznych prob albo zadziala przekierowanie ale to pozostale adresy linki wskazuja na domena.pl albo firefox wywala błąd o złym przekierowaniu... proszę o pomoc i z góry dziękuję, ponizej moj plik httacces..


##
# @package Joomla
# @copyright Copyright (C) 2005 - 2012 Open Source Matters. All rights reserved.
# @license GNU General Public License version 2 or later; see LICENSE.txt
##

##
# 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.

RewriteEngine On

## 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!
#
# 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]
#RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,NE,L,QSA]
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Wed, 15 Apr 2020 20:00:00 GMT"
Header set Cache-Control "public"
</FilesMatch>
#Header unset ETag
FileETag none
#
## 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}]
#
# 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 something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
# 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.

mjmartino
18-07-2014, 19:56
Try


Redirect permanent domena.pl/index.php domena.pl
Redirect permanent domena.pl/strona-startowa.html domena.pl

rynek25
19-07-2014, 22:33
Niestety z takim przekierowaniem wywala w przeglądarce blad 500, pomoże ktoś? :(

mjmartino
20-07-2014, 00:23
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Pozbędziesz się indexu ale poco tak jak można właczyć adresy z przedrostkiem i niebędzie wywoływany index.php
Poza tym za bardzo kombinujesz mi się wydaje ;)

rynek25
20-07-2014, 12:27
adresy z przyrostkiem sa wlaczone, zalezy mi na przekierowaniu 301 index.php na domene gdyz jest spore niebezpieczenstwo ze google zakwalifikuje domena.pl/index.php jako glowna strone niz domena.pl a jak wiadomo linkowanie idzie na domena.pl wyobraz co by sie stalo z pozycjami gdyby bylo odworotnie, a w zasadzie to juz ponioslem taka strate i teraz musze odwrocic skutki... zaraz przetestuje powyzsyz kod, ale mam go zamienic z jakims juz istneijacym czy dokleic????

- - - Updated - - -

niestety powyzsze przekierowanie tez nie pomoglo...

mjmartino
20-07-2014, 20:23
przepraszam bardzo a domena.pl/index.php to nie jest główna strona ?
Żadne 301 Ci nie jest potrzebne.
Jeśli G wskażesz że Twoja domena będzie bez www to tak będzie indexował i tylko tak!

zeki
20-07-2014, 23:37
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/?$1 [L]

Tak spróbuj.

rynek25
21-07-2014, 10:41
mjamartino widze ze wiedza o pozycjonowaniu u ciebie na najwyzszym poziomie nie jest... wskazywac google owszem mozna i jest to zrobione wtedy linkujesz albo na domena z przedrostkiem www lub nie- jednak po update alkgorytmow moze zdarzyc sie taka sytuacja ze google owszem uzna twoja domene bez www lub z www tak jak wskazywales ale za glowna uzna link z index.php a Ty linkujesz do domena bez index.php, efekty nie trudno sobie wyobrazic prawda? moze okazac sie ze massa wartosciowych linkow pozyskanych na domena bez index.php nic nie znaczy bo google uznaje za glowna witryne ta z index.php a do niej nie prowadza linki...

zeki zaraz sporobuje przekierowanie i dam znac

Karol99
21-07-2014, 12:18
Spójrz na to rozwiązanie (http://writenowdesign.com/joomla-tutorials/joomla-trips-and-tricks/joomla-redirect-index-php-home-page-to-site-root/).

rynek25
21-07-2014, 12:50
Karol99 dziekuje Ci bardzo działa idealnie, a nie wiesz moze jak przekierowac domena.pl/strona-glowna na domena.pl ??? Leci punkt do Ciebie!

mjmartino
21-07-2014, 14:09
mjamartino widze ze wiedza o pozycjonowaniu u ciebie na najwyzszym poziomie nie jest... wskazywac google owszem mozna i jest to zrobione wtedy linkujesz albo na domena z przedrostkiem www lub nie- jednak po update alkgorytmow moze zdarzyc sie taka sytuacja ze google owszem uzna twoja domene bez www lub z www tak jak wskazywales ale za glowna uzna link z index.php a Ty linkujesz do domena bez index.php, efekty nie trudno sobie wyobrazic prawda? moze okazac sie ze massa wartosciowych linkow pozyskanych na domena bez index.php nic nie znaczy bo google uznaje za glowna witryne ta z index.php a do niej nie prowadza linki...

Dobra po tym co napisałeś, musisz się jeszcze dużo nauczyć ;)
Pozdrawiam.

Karol99
22-07-2014, 19:03
jak przekierowac domena.pl/strona-glowna na domena.pl ?

A zwykłe redirect w htaccess nie wystarczy?


Redirect /strona-glowna http://www.domena.pl/

agatkasu
22-07-2015, 11:24
Witam,
prze****łam już wszystko, albo prawie, wpisywałam też, i nic nie działa. Obecnie mam kod, który polecaliście na forum:
RewriteEngine On


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://www.xyz.com/$1 [R=301,L]

ale też nie działa. Jak zrobić to przekierowanie?

Banita
27-11-2015, 16:51
Ale z czego na co?
z www na bez www?



RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^(.*) http://example.com/$1 [QSA,L,R=301]