Solved

How to tell Apache to ignore a certain part of an SEO friendly URL, but include the rest

Posted on 2008-10-18
2
243 Views
Last Modified: 2012-05-05
I'm using SEO friendly URLs throughout a client site. The RewriteRule function is being used to do this, as follows:

RewriteRule ^index/(.*)/ index.php?p=$1
RewriteRule ^index/(.*)/(.*)/ index.php?p=$1&q=$2

I want to write some URLs for a forum topic page, as follows:

/index/thread/this-is-the-topic-title-1/

Basically the only thing I want being passed to the PHP query is the number (this is the Thread ID), the text "this-is-the-topic-title-" needs to be ignored, but I don't know how to do that.

Any ideas?

Thanks in advance.
0
Comment
Question by:DReade83
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
diaF earned 500 total points
ID: 22747829
try

RewriteRule ^index/(.*)/.*-([0-9]*)/ index.php?p=$1&q=$2
0
 

Author Closing Comment

by:DReade83
ID: 31507396
Thank you very much - that worked a treat. :-)
0

Featured Post

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question