2012-06-25 4 views
1

rocketroofing.us/rocket으로 이동하면 rocketroofing.us/rochester-minnesota-roofing-contractor?/rocket으로 리디렉션됩니다. 해당 쿼리 문자열을 추가하는 이유는 무엇입니까? 어떻게 해결할 수 있습니까?htaccess redirect가 쿼리 문자열을 덧붙입니다.

htaccess로 :

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/

    #Removes access to the system folder by users. 
    #Additionally this will allow you to create a System.php controller, 
    #previously this would not have been possible. 
    #'system' can be replaced if you have renamed your system folder. 
    RewriteCond %{REQUEST_URI} ^system.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    #When your application folder isn't in the system folder 
    #This snippet prevents user access to the application folder 
    #Submitted by: Fabdrol 
    #Rename 'application' to your applications folder name. 
    RewriteCond %{REQUEST_URI} ^application.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    #Checks to see if the user is attempting to access a valid file, 
    #such as an image or css document, if this isn't true it sends the 
    #request to index.php 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 

    # redirect from the old controller names to the new ones to try and help our SEO. 
    #redirect 301/http://rocketroofing.us/rochester-minnesota-roofing-contractor 
    redirect 301 /rocket http://rocketroofing.us/rochester-minnesota-roofing-contractor 
    redirect 301 /about http://rocketroofing.us/about-rochester-rocket-roofing 
    redirect 301 /faq http://rocketroofing.us/frequently-asked-questions 
    redirect 301 /contact http://rocketroofing.us/contact-minnesota-roofing-company 

</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. 
    # Submitted by: ElliotHaughin 

    ErrorDocument 404 /index.php 
</IfModule> 

경로 :

$route['default_controller'] = "rocket"; 
$route['404_override'] = ''; 
// used to try and increase my SEO 
$route['rochester-minnesota-roofing-contractor'] = 'rocket'; 
$route['about-rochester-rocket-roofing'] = 'about'; 
$route['frequently-asked-questions'] = 'faq'; 
$route['contact-minnesota-roofing-company'] = 'contact'; 

답변

2

현재 동작을 요청하는 :

RewriteRule ^(.*)$ index.php?/$1 [L] 

$1 당신이 정규 표현식에 일치 무엇에 역 참조입니다 .*.

redirect 301 /rocket http://rocketroofing.us/rochester-minnesota-roofing-contractor? 

참고 뒤에 물음표 :이 같은 자신을 정의하지 않는 한

그 쿼리 문자열

가 사용됩니다. 문서 번호 here :

기본적으로 쿼리 문자열은 변경되지 않고 전달됩니다. 그러나 문자열을 포함하는 대체 문자열에 문자열 부분을 포함하는 URL을 만들 수 있습니다. 대체 문자열 안에 물음표를 사용하여 쿼리 문자열에 다음 텍스트를 다시 입력해야 함을 나타내십시오. 기존 쿼리 문자열을 지우려면 대체 문자열을 물음표로 끝냅니다. 신규 및 기존 쿼리 문자열을 결합하려면 [QSA] 플래그를 사용하십시오.

+0

제안 사항을 사용할 때 물음표가 리디렉션 된 URL에 있습니다. 리디렉션 된 URL에 물음표가 표시되지 않는 방법이 있습니까? – Catfish

+0

@Catfish - 구성 파일에서 지정하지만 리디렉션 된 URL의 일부가 아닌 것으로 간주됩니다. 왜 그렇게 생각하니? 코드를 감지 할 수있는 코드가 있습니까? –

+0

오, 내가해야 할 일은'RewriteRule'에서 물음표를 제거하는 것 뿐이에요? 이런, 왜 그렇게 말하지 않았어! – Catfish

관련 문제