₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,326,289 members, 8,425,885 topics. Date: Saturday, 13 June 2026 at 09:47 AM

Toggle theme

Prevent Mod_rewrite From Rewriting Image Links - Webmasters - Nairaland

Nairaland ForumScience/TechnologyWebmastersPrevent Mod_rewrite From Rewriting Image Links (818 Views)

1 Reply (Go Down)

Prevent Mod_rewrite From Rewriting Image Links by ivcraig(op): 4:53pm On Feb 16, 2016
Hello guys. I'm trying to cleanup my the links on a website I'm working on, using htaccess
. My rewrite rule works fine, but the images on the page don't display because a part of image links are also rewritten.
Re: Prevent Mod_rewrite From Rewriting Image Links by vicsrael: 6:30pm On Feb 16, 2016
there is a way to exempt physical files Google it
Re: Prevent Mod_rewrite From Rewriting Image Links by ivcraig(op): 7:20pm On Feb 16, 2016
vicsrael:
there is a way to exempt physical files Google it
I've tried all methods I found online. None seems to work.
Re: Prevent Mod_rewrite From Rewriting Image Links by ivcraig(op): 12:04am On Feb 18, 2016
I tried this but it didn't work.
Rewriterule ^tracks-([0-9]+)+([0-9a-zA-Z_-]+)$
This worked tho:
Rewriterule ^tracks/([0-9]+)/([0-9a-zA-Z_-]+)$
I changed the slashes to dashes. I guess the
slashes convert the link to directories, which also reroutes all files on the page.
Re: Prevent Mod_rewrite From Rewriting Image Links by vicsrael: 9:34am On Feb 18, 2016
try this


<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Re: Prevent Mod_rewrite From Rewriting Image Links by ivcraig(op): 7:27pm On Feb 18, 2016
vicsrael:
try this


<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Thanks man. What's the advantage of this over the solution I got. I'm very interested in making positive changes and learn new stuff.
From the looks of this one it seems I can easily redirect all my links.
Re: Prevent Mod_rewrite From Rewriting Image Links by vicsrael: 12:17pm On Feb 20, 2016
ivcraig:
Thanks man. What's the advantage of this over the solution I got. I'm very interested in making positive changes and learn new stuff.
From the looks of this one it seems I can easily redirect all my links.
ye is good you can chat me up on whatsapp 08130687861
Re: Prevent Mod_rewrite From Rewriting Image Links by Nobody: 3:06pm On Feb 20, 2016
ivcraig:
Hello guys. I'm trying to cleanup my the links on a website I'm working on, using htaccess
. My rewrite rule works fine, but the images on the page don't display because a part of image links are also rewritten.

1 Reply

Efficient Strategy To Have Good LinksRansomware Attacks 2017: What Is Ransomware And How To Prevent, Stop RansomwareEasy Way To Convert Image Texts To Normal Plain Texts234

Massive Traffic Generation For Your Blog4 Lessons We Learned From Mark Zuckerberg's Visit To NigeriaWhat Are The Challenges Facing You As A Webmaster?