Rewrite URL and remove part with .htaccess -


i stuck .htaccess file, , need :). have wordpress installation using testing. in folder , use .htaccess there. rules use far:

######### custom ######### rewriteengine on  # ignore folders rewritecond %{request_uri} "/af1wp/" rewriterule (.*) $1 [l]  ############### # me # ############### # home (senne tijdeman) rewritecond %{remote_addr} ^###\.###\.###\.###$ rewritecond %{http_host} ^((www.)?([a-z0-9_\-]+).)?alleenf1.nl$ rewritecond %{request_uri} !^/af1wp/$ rewriterule ^(.*)$ /af1wp/$1 [l] 

this works (with real ip address of course), no problem there. want rewrite exisiting url's new format. old url this:

http://alleenf1.nl/nieuws/qogbb/raikkonen-alles-is-mogelijk-in-australi

the new url should this:

http://alleenf1.nl/raikkonen-alles-is-mogelijk-in-australi

the part want remove "nieuws/qogbb/" not same, have use regex that. tried did not work @ all.

i thought simple, apparently not me unfortunately. have 2 questions.

  1. what right rewriterule this?
  2. where should put it. in .htaccess of root folder, or af1wp folder wordpress install is?

tnx in advanced


to awnser questions poncha below:

  1. yes, url's start folders. clarify (was not clear) part "nieuws" same, not second part (call id).
  2. i prefer redirect.
  3. the file /raikkonen-alles-is-mogelijk-in-australi post in wordpress. wordpress installation resides in folder af1wp, moved root folder when going live.

try this:

rewriteengine on rewriterule ^nieuws/([^/]+)/(.*) /af1wp/$1 [r=301,l,qsa] 
  1. this match urls starting "nieuws"
  2. for now, rewrite target /af1wp/, change / when moving wordpress.
  3. when move wordpress, you'll need mix in rule inside wordpress rules, has rewrite rules of own - place rule above rules.
  4. the flags used here:
    • r=301 - redirect http status 301 (moved permanently).
    • l - last rule (stop rules parsing after successful match of rule)
    • qsa - query-string-append (append original query string rewritten request).

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -