Jump to content

Using titles - rewrite


eevan79

Recommended Posts

I try to integrate WordPress perm links into new cms (custom), so I need to make rewrite condition for old links in posts.

 

 

So I have links like this:

site.com/category/page-title

or

site.com/category/page-title/

 

 

site.com/games/text/page-title

or

site.com/games/text/page-title/

etc.

 

 

I need to get last request uri ( url after last "/" ) and rewrite to:

site.com/index.php?title=page-title

I have tried various methods but nothing do not succeed.

Link to comment
Share on other sites

I forgot to include code. This is what I have tried (on localhost):

 

 

 

RewriteEngine On
RewriteBase /wp/


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9-]+)$ wp/index.php?title=$1 [L]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]

 

 

So if i have link like this: http://localhost/wp/test I got: title=test. But if I have more "/" or slash on the end of url I get page with wrong links (including .css etc).

 

 

I just need to get "text" after last trailing slash and rewrite to title=?

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.