logo
down
shadow

Htaccess redirecting wrong page


Htaccess redirecting wrong page

By : Vlad Nistor
Date : January 12 2021, 08:33 AM
wish of those help As soon as the third rule is applied then automatically the third rule gets applied too, since its pattern matches the target of the first rule.
With the apache http server from version 2.4 onwards you can use the END flag instead of the L flag to prevent that:
code :
RewriteEngine On
RewriteBase /

RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)\.php$ view-product.php?catSeoUrl=$1&subCatSeoUrl=$1&productSeoUrl=$3 [END]
RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)\.php$ products.php?catSeoUrl=$1&subCatSeoUrl=$1 [END]
RewriteRule ^([a-zA-Z0-9-]+)\.php$ products.php?catSeoUrl=$1 [END]
RewriteEngine On
RewriteBase /

RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)\.php$ view-product.php?catSeoUrl=$1&subCatSeoUrl=$1&productSeoUrl=$3 [END]
RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)\.php$ products.php?catSeoUrl=$1&subCatSeoUrl=$1 [END]
RewriteCond %{REQUEST_URI} ^([^\]+)\.php$
RewriteRule ^([a-zA-Z0-9-]+)\.php$ products.php?catSeoUrl=$1 [END]


Share : facebook icon twitter icon
.htaccess Redirecting to wrong page

.htaccess Redirecting to wrong page


By : Mihai Muresan
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I can see 2 main issues here:
You should avoid redirecting to index.php for real file/dir/link. Don't use / as the starting slash in target URL otherwise it will not be relative your RewriteBase
code :
RewriteBase /naranjeshaltd/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
HTACCESS redirecting to wrong page

HTACCESS redirecting to wrong page


By : Federico Saccà
Date : March 29 2020, 07:55 AM
it should still fix some issue With your .htaccess configuration you are redirecting only /admin to /admin/login/.
To support a possible trailing slash you should go for something like:
code :
RewriteRule ^admin/?$ http://localhost/systems/admin/login/ [R=301,L]
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteRule ^admin$ http://localhost/systems/admin/login [R=301,L]
Htaccess redirecting in the wrong way

Htaccess redirecting in the wrong way


By : Saugata
Date : March 29 2020, 07:55 AM
hop of those help? I'm using a simple HTAccess redirect rule to redirect :- , I've written this simple re-write for you.
code :
#ErrorDocument 404 /
RewriteEngine On
#RewriteCond %{SERVER_PORT} 80

RewriteRule ^s/(.+)$ s.php?id=$1 [L,QSA]
Link is fine yet .htaccess redirecting to wrong page

Link is fine yet .htaccess redirecting to wrong page


By : Micelna
Date : March 29 2020, 07:55 AM
htaccess redirecting to the wrong page when using multiple rewriterules

htaccess redirecting to the wrong page when using multiple rewriterules


By : Rajdeep
Date : March 29 2020, 07:55 AM
Hope this helps Both of your listen/ rules should appear before other rules and moreover 2 RewriteCond are only being applied to next immediate RewriteRule.
You may use these rules to replace all of your code:
code :
Options -Indexes
RewriteEngine On

# only allow rewriting to paths that don't exist
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

# example.com/listen/$id
RewriteRule ^listen/([\w-]+)/?$ track.php?id=$1 [L,QSA,NC]

# example.com/listen/$id/secret
RewriteRule ^listen/([\w-]+)/([\w-]+)/?$ track.php?id=$1&secret=$2 [L,QSA,NC]

# no php extension
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]

# example.com/username
RewriteRule ^([\w-]+)/?$ profile.php?uid=$1 [L,QSA]

# example.com/username/$tab
RewriteRule ^([\w-]+)/([\w-]+)/?$ profile.php?uid=$1&tab=$2 [L,QSA]
shadow
Privacy Policy - Terms - Contact Us © voile276.org