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
235 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
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
PHP Variable into a number 3 35
php mail headers 2 13
lastpass auto fill login form 5 25
regex expression 9 23
These days socially coordinated efforts have turned into a critical requirement for enterprises.
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now