Welcome Guest, Not a member yet? Register   Sign In
.htaccess, 301 redirect and question mark
#1

(This post was last modified: 03-17-2015, 02:25 AM by Krycek.)

Hello,

I have an htaccess wich has an 301 redirect.
However the redirect gives me as result

contact/?/my-page

I need to get rid of the /?/my-page

Code:
<IfModule mod_rewrite.c>
    Redirect 301 /my-page   http://www.domain.nl/contact?
    
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule ^(.*)$ index.php?/$1 [L]    
    
        
    RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond $1 !^(index\.php|images|robots\.txt|css)
    RewriteRule ^(.*)$ index.php?/$1 [L]    
    
            
</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>

Using Google I got severall hits where a ? in the redirect was recommended or using a RewriteRule instead of an Redirect.
However it does not seem to work.

Anyone an idea ?
Reply
#2

I found it:

Code:
<IfModule mod_rewrite.c>    
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^my-page http://www.domain.nl/contact [R=301,L]
    
    RewriteCond %{REQUEST_URI} ^system.*    
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    RewriteCond %{REQUEST_URI} ^application.*    
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule ^(.*)$ index.php?/$1 [L]        
        
    RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond $1 !^(index\.php|images|robots\.txt|css)
    
    RewriteRule ^(.*)$ index.php?/$1 [L]    
    
            
</IfModule>

Note : (and that was also my problem) delete the cache after every change.
I have RewriteRule ^my-page http://www.domain.nl/contact [R=301,L] before, but didn't cleared my history (firefox)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB