url rewrite redirect
Moderator: General Moderators
url rewrite redirect
hi
I need help with a rewrite rule
it should basically go something like this:
example one:
http://www.erp.com/topic-erp-software ==> http://www.erp.com/articles-a-news/s...text/keywords:erp+software/cat:3/order:rdate.html
example two:
http://www.erp.com/topic-a-b-c-d-etc ==> http://www.erp.com/articles-a-news/s...text/keywords:a-b-c-d-etc/cat:3/order:rdate.html
the user might type in the address bar the short one I want the rewrite rule to take the red word(s) from the short address and put it into the long one
here is the one I have but it doesn't seem to work:
RewriteRule ^(.*)/topic-(^[a-z0-9_-])$ /articles-a-news/search-results_m156/query:all/dir:1/scope:title_introtext_fulltext/keywords:$1/cat:3/order:rdate.html
Thanks
for your help
I need help with a rewrite rule
it should basically go something like this:
example one:
http://www.erp.com/topic-erp-software ==> http://www.erp.com/articles-a-news/s...text/keywords:erp+software/cat:3/order:rdate.html
example two:
http://www.erp.com/topic-a-b-c-d-etc ==> http://www.erp.com/articles-a-news/s...text/keywords:a-b-c-d-etc/cat:3/order:rdate.html
the user might type in the address bar the short one I want the rewrite rule to take the red word(s) from the short address and put it into the long one
here is the one I have but it doesn't seem to work:
RewriteRule ^(.*)/topic-(^[a-z0-9_-])$ /articles-a-news/search-results_m156/query:all/dir:1/scope:title_introtext_fulltext/keywords:$1/cat:3/order:rdate.html
Thanks
for your help
Re: url rewrite redirect
For the first part,
Code: Select all
^/?topic-([a-zA-Z0-9_-]+)$Re: url rewrite redirect
thanks
I made the changes but it is still not working
I think that there is already a rewrite going on and it is scrubbing my rule
I made the changes but it is still not working
I think that there is already a rewrite going on and it is scrubbing my rule
Re: url rewrite redirect
ok here is where I am at
if I put the following at the top of the .htaccess page
it works to redirect the page to the destination but I loose the pretty url
if I remove the R=301 i get a 404 no page exists error
how can I make this so I can keep the pretty URL and still go to the correct page?
pretty url:http://www.erp.com/topic-a-b-c-d-etc
Destination: http://www.erp.com/articles-a-news/s... ... rdate.html
Thanks
Nate
if I put the following at the top of the .htaccess page
Code: Select all
RewriteRule ^/?topic-([a-zA-Z0-9_-]+)$ /articles-a-news/search-results_m156/query:all/dir:1/scope:title_introtext_fulltext/keywords:$1/cat:3/order:rdate.html [NC, R=301] if I remove the R=301 i get a 404 no page exists error
how can I make this so I can keep the pretty URL and still go to the correct page?
pretty url:http://www.erp.com/topic-a-b-c-d-etc
Destination: http://www.erp.com/articles-a-news/s... ... rdate.html
Thanks
Nate
Re: url rewrite redirect
Add a
before the rule and remove the "/?". (Then remove the R=301.)
Code: Select all
RewriteBase /Re: url rewrite redirect
okay this is what I have
it is still not working I go to the 404 page error !
Code: Select all
RewriteBase /
RewriteRule ^topic-([a-zA-Z0-9_-]+)$ /articles-a-news/search-results_m156/query:all/dir:1/scope:title_introtext_fulltext/keywords:$1/cat:3/order:rdate.html [NC,L] Re: url rewrite redirect
finally
Got the rr to work
solution add a [P]
Got the rr to work
solution add a [P]
Code: Select all
RewriteBase /
RewriteRule ^topic-([a-zA-Z0-9_-]+)$ /articles-a-news/search-results_m156/query:all/dir:1/scope:title_introtext_fulltext/keywords:$1/cat:3/order:rdate.html [L,NC,P]
Re: url rewrite redirect
If [PT] instead works, use that.
Re: url rewrite redirect
My dilemma just got a little more challenging
the rewrite works! almost
current rule:
the problem is the format of what is passed to ( $1)
it is currently passed as:
green-eggs-and-ham
I need it to passed as:
green+eggs+and+ham
current logic:
the rewrite works! almost
current rule:
Code: Select all
RewriteBase /
RewriteRule ^topic-([a-zA-Z0-9_-]+)$ /articles-a-news/search-results_m156/query:all/dir:1/scope:title_introtext_fulltext/keywords:$1/cat:3/order:rdate.html [L,NC,P] it is currently passed as:
green-eggs-and-ham
I need it to passed as:
green+eggs+and+ham
current logic:
Code: Select all
RewriteRule ^topic-([^-/]+(-[^-/]+)*)$ /articles-a-news/search-results_m156/query:all/dir:1/scope:title_introtext_fulltext/keywords:$1/cat:3/order:rdate.html [L,NC,P]