₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,347,905 members, 8,529,792 topics. Date: Friday, 04 December 2026 at 03:06 PM

Toggle theme

Prevent Mod_rewrite From Rewriting Image Links - Webmasters - Nairaland

Nairaland Forum › Science/Technology › Webmasters › Prevent Mod_rewrite From Rewriting Image Links (855 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 Links • Ransomware Attacks 2017: What Is Ransomware And How To Prevent, Stop Ransomware • Easy Way To Convert Image Texts To Normal Plain Texts • 2 • 3 • 4

How Much Can I Get A Domain Name • Google Sent Payment Today, 3rd July. Is It A Mistake Or Change Of Policy • How I Get 200,000 Valid USA Email Address For Free.