Project

General

Profile

url redirect multiple extensions

Added by maxentry over 4 years ago

I am trying to make several url rewrites and redirects from an old site.
1. Redirecting a page that had 2 different extensions - I now want this redirected to another extension

url.redirect = ("^/staticpage\.(php|aspx)" => "/newstaticpage.html" )

I now get a 404 when I visit either /staticpage.php or /staticpage.aspx

2. Rewriting several keyword rich urls to one page

url.rewrite-once = ("^/(first|second|third|fourth)" => "/realpage" )

Any help with the correct syntax to use?


Replies (4)

RE: url redirect multiple extensions - Added by gstrauss over 4 years ago

Your syntax looks correct, so you should see what is being sent back to your browser as a redirect (first case), or if lighttpd is doing the rewriting and what file it is trying to access (in the second case). You don't provide any error message or any observations for the second case, so that question is utterly useless.

I now get a 404 when I visit either /staticpage.php or /staticpage.aspx

Check your browser to see what Location: header was returned and you'll probably find your mistake.

Judging from the questions above, you're probably not comfortable looking at lighttpd logs, but if you think you are, see the debug settings that you can enable in the lighttpd configuration. Docs_ConfigurationOptions

RE: url redirect multiple extensions - Added by maxentry over 4 years ago

thanks for the reply.
In both cases, I get my 404 page. In the second instance when I browse to either of first|second|third … I get the 404 (as I do in the first when I browse to either extensions of staticpage).
To answer your question, Nothing changes in the browser bar - it remains the page / location I entered and though I am not uncomfortable reading lighttpd logs, I have no clue which to set! I just tried the fastcgi.debug=1 and the output is not helpful - any pointers?

RE: url redirect multiple extensions - Added by gstrauss over 4 years ago

any pointers?

Sorry, I am unable to provide the level of assistance that you require. You do not seem to even know the basics of looking at request and response headers in your browser and you appear to have glossed over the section titled Debug in the options page to which I linked. Here's a more specific link. Core Debug Info

Good luck!

RE: url redirect multiple extensions - Added by maxentry over 4 years ago

I am sure that response was with best intentions but have to say you do not need to take it all out on me!

I do know the basics of looking at headers ins a browser but it never occurred to me that is what you were asking me to look at. And yes, I did look at the configuration link (specifically the core debug section and all), but that did not make sense. Take it from me, I wouldn't have taken the time to open an account on this wiki / forum if I already knew how to solve the issue I have. At think point I'd ordinarily thank you for the input and pointers, but I shall refrain from doing the right thing (that is what your attitude deserves).

If anyone else is able to offer some help, I'd gladly take it.

    (1-4/4)