473,506 Members | 17,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mod_rewrite help

Hello. How do I do this:

If a visitor types in any number after my url, I want mod_rewrite to
convert it to my url/anotherpage.html?number=number_visitor_typed

Example:

http://www.mysite.com/12345678.html

would result in:

http://www.mysite.com/anotherpage.html?number=12345678

another example:

http://www.mysite.com/000111000.html

would result in:

http://www.mysite.com/anotherpage.html?number=000111000

Thank you.

Jul 17 '05 #1
1 2245
Westcoast Sheri wrote:
Hello. How do I do this:

If a visitor types in any number after my url, I want mod_rewrite to
convert it to my url/anotherpage.html?number=number_visitor_typed

Example:

http://www.mysite.com/12345678.html

would result in:

http://www.mysite.com/anotherpage.html?number=12345678

another example:

http://www.mysite.com/000111000.html

would result in:

http://www.mysite.com/anotherpage.html?number=000111000

Thank you.

No need to double-post, and this probably belongs in an apache forum.

see: << http://httpd.apache.org/docs-2.0/mod...ml#rewriterule >>
for details in the re-write function.

I am not that good with regexpr so, you may need to experiment with
this...

RewriteRule ^(*\/0-9)\.html$ rewrite.php?file=$1.html

What this means is that you substitute all htmlfiles that have [0-9] and
send them through your rewrite php script. BTW I found this by going to
both the apache and php online manuals and did site searches for
rewrite. These are the resulting pages:

http://www.php.net/imagecreatefrompng
http://httpd.apache.org/docs-2.0/mod...ml#rewriterule

I would consider a front-page with a form for typing the number, then
redirecting from that point.

<? php
///////////////// My standar PHP header for > 2.0

if (!empty($_GET))
{
extract($_GET);
}
else if (!empty($HTTP_GET_VARS))
{
extract($HTTP_GET_VARS);
}

if (!empty($_POST))
{
extract($_POST);
}
else if (!empty($HTTP_POST_VARS))
{
extract($HTTP_POST_VARS);
}
if (isset ($flag))
{ //code to redirect to http://new.site.dom/$number.html
echo '<form method=post><br><center><input TYPE=submit
value=Back></center>';
}
else
{ echo "<form method=post>";
echo "<input type=text name=number> Enter Page Number<br><p>";
echo "<input type=hidden name=flag value=1>";
echo "<input TYPE=submit value=Submit>";
echo "<input TYPE=reset value=Reset>";
echo "</form>";
}

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2540
by: Support | last post by:
Hello, I am running RedHat & Apache. RedHat does not allow creating more that 32000 subdirectories in one folder due to #defined constant limitation in the core code. I need to display 47000...
6
1742
by: namemattersnot | last post by:
ok. i give up. need help :) here's the rule: RewriteRule ^test/(.+)/(.*)$ /index.php$2 if i request: http://localhost/test/keyword/?show=files it properly redirects me. NOW, if i change...
11
2032
by: joelbyrd | last post by:
I have a people-networking type site in which each user has their own profile page, with their user id encoded. So, for example, the web address of their page might look like...
4
2467
by: Hermann.Richter | last post by:
I want to rewrite URLs like http://domain/dir/file.php?var1=val1&var2=val2#anchor to http://domain/dir/file?var1=val1&var2=val2#anchor In other words, I want to strip out the php extension ...
5
4831
by: laredotornado | last post by:
Hi, I have verified that mod_rewrite is enabled on my Apache 2.2 instance. However, now I'm having a problem just serving pages using .htaccess files. Following Rik's advice, my .htaccess file...
0
1784
tj111
by: tj111 | last post by:
I'm fairly new when it comes to Apache, but regular expressions aren't really an issue for me. I'm designing a new website for one of the companies I'm employed by. I test it and run it locally,...
3
1834
by: dennis.sprengers | last post by:
* I'm trying to work out some rewrite rules that should do the following: case 1: a request to mysite.com: rewrite http://www.mysite.com/files/sheets.ppt to...
7
1727
by: Dale | last post by:
again, i know this is OT...just move along to the next post if it bugs you. :) i had been trying to have this: project.66.204.32.110 from the client browser, map to a virtual host where the...
2
2759
by: theoni | last post by:
I need some help with something I am trying to solve here and cannot find anything online I need to mod_rewrite to redirect with 301 to remove duplicate content from google the following: ...
0
7220
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3178
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1534
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.