Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

mod_rewrite apache

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
5 posts • Page 1 of 1
Author
Message
wifiED
n00b
n00b
User avatar
Posts: 13
Joined: Mon Mar 31, 2008 5:38 pm
Location: South Africa

mod_rewrite apache

  • Quote

Post by wifiED » Tue Apr 21, 2009 1:40 pm

Hey Guys

Wonder if anyone will be able to assist me.

I am wanting to strip the tailing characters from a file name (file.pdf?abcdefhekjkjhsdhsd) so that apache just serves the plain file name (file.pdf)
Can anyone help with a quick way to do it using mod_rewrite in apache?

Any help would be appreciated

Thanks
Top
elgato319
Guru
Guru
Posts: 546
Joined: Thu Sep 15, 2005 9:45 am

  • Quote

Post by elgato319 » Wed Apr 22, 2009 6:58 am

mod_rewrite is not responsible for this.
The appliction that generates the urls needs to be altered.
Top
wifiED
n00b
n00b
User avatar
Posts: 13
Joined: Mon Mar 31, 2008 5:38 pm
Location: South Africa

  • Quote

Post by wifiED » Thu Apr 23, 2009 9:25 am

Hi there

Thanks but yes i am aware of that. But the reason for this is that the application generates a unique tail on the file so that it no.1 doesnt get cached and no.2 is able to keep track of the unique downloads.

8)
Top
scherz0
Apprentice
Apprentice
Posts: 154
Joined: Thu Oct 02, 2008 12:16 pm

Re: mod_rewrite apache

  • Quote

Post by scherz0 » Thu Apr 23, 2009 1:04 pm

wifiED wrote:I am wanting to strip the tailing characters from a file name (file.pdf?abcdefhekjkjhsdhsd) so that apache just serves the plain file name (file.pdf)
You should not have to use mod_rewrite, since by default the mapping is : URL to filename (i.e. without the query string). Do you confirm that in the error log, apache complains about the file "file.pdf?abcdefhekjkjhsdhsd" missing ?
Top
cach0rr0
Bodhisattva
Bodhisattva
User avatar
Posts: 4123
Joined: Thu Nov 13, 2008 11:14 pm
Location: Houston, Republic of Texas

  • Quote

Post by cach0rr0 » Thu Apr 23, 2009 6:54 pm

i can help with the regex, cant say whether or not this is an appropriate solution


at least in perl or whatnot it'd be something like

Code: Select all

s/(.*)\?[^?]+/$1/
note that regex will break if you have multiple question marks in the Request-URI

this one does not, but isn't as precise

Code: Select all

s/(.*)\?.*/$1/
hope that helps?
Top
Post Reply

5 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic