Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,165,774 members, 7,862,536 topics. Date: Sunday, 16 June 2024 at 07:02 PM

Prevent Mod_rewrite From Rewriting Image Links - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Prevent Mod_rewrite From Rewriting Image Links (705 Views)

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)

(1) (Reply) (Go Down)

Prevent Mod_rewrite From Rewriting Image Links by ivcraig(m): 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(m): 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(m): 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>

1 Like

Re: Prevent Mod_rewrite From Rewriting Image Links by ivcraig(m): 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)

How To Create A Forum Like Infinix Xclub / How To Get 7gb For #700 On Airtel / Articles/content Writer Wanted Urgently.

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.