help me with url rewriting

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Example URLs should be live. Rather than making up names, give real ones that can be tested.

Also, the location of the .htaccess file with the directives matters. The example you give should be in "[DOCUMENT ROOT]/subdir/subdir/.htaccess". If you want every URL ending with "punk.png" to be redirected, add the following in [DOCUMENT ROOT]/.htaccess:
Code:
RewriteRule punk.png$ /punk.png
This also uses an internal redirect. The rewrite isn't visible to the site visitor (which may or may not be desirable) and is more efficient. An external redirect sends a message to the browser that the resource is at a different URL, which then has to issue a second request.

You'll still need the RewriteBase directive under the new virtual host configuration (see how useful it is to read the service alerts?).
 
Last edited:

bioshock

New Member
Messages
27
Reaction score
0
Points
0
yes i was looking for internal redirect thanks misson would you please explain how it works i mean the syntax

what the $ sign for
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
would you please explain how it works i mean the syntax
What part of the syntax, exactly? You get an external rewrite whenever you include the scheme and host name in the substitution URL, or you use the redirect flag (R). Use neither the flag nor the scheme and you have an internal redirect. Read the rewrite engine documentation for more.

what the $ sign for
The pattern in a rewrite rule is a regular expression. The "$" atom matches the end of a string. Read up on the most basic features of regular expressions to start, then pick a RE tutorial for the rest.
 
Top