SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
Thread: Mod Rewrite help needed!
-
Jan 20, 2005, 02:38 #1
- Join Date
- Nov 2003
- Location
- United Kingdom
- Posts
- 2,120
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Mod Rewrite help needed!
Hi,
I am using Mod Rewrite accoss the whole of my site and I was wondering if it would be possible to do something with the following rewriterule so that when I type in something like: http://www.simplysearch4it.com/a00000/1.html it would then go to the http://www.simplysearch4it.com/artic...00000&a=1.html
RewriteRule ^article/a(.*)/(.*).html article.php?b=$1&a=$2
Is there any way of doing this?
Thanks in advance.Affiliate Programs Directory - Over 3,000 Programs.
----> 150+ CPA Networks | Earn upto $.75 CPM on Banner Ads
-
Jan 20, 2005, 02:58 #2
- Join Date
- Mar 2004
- Posts
- 1,647
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:RewriteRule a(.*?)html article.php?b=$1&a=$2
-
Jan 20, 2005, 03:39 #3
- Join Date
- Jan 2005
- Location
- Redditch UK
- Posts
- 8
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Help me also please after John.
~~~~~~~~~~~~~~~~~~~
Can anyone alter this for me to include use of www. as well as no www. and also see how the whole thing could be tidied up and written correctly but with exact same results:
~~~~~~~~~
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
RewriteCond %1 !^www$ [NC]
RewriteRule ^.*$ /%1\.php [R,QSA]
~~~~~~~~~
Thanks to anyone who can help.
-
Jan 20, 2005, 03:39 #4
- Join Date
- Apr 2004
- Location
- germany
- Posts
- 4,324
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
john278
(.*) is just too common for mod_rewrite. You have to be more specific in your expression, for example:
RewriteRule article/a([0-9]+)/([^.]+) article.php?b=$1&a=$2
-
Jan 20, 2005, 03:42 #5
- Join Date
- Jan 2005
- Location
- Redditch UK
- Posts
- 8
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
hello stereofrog
~~~~~~~~
Any chance on help with above please?
Thanks
-
Jan 20, 2005, 03:55 #6
- Join Date
- Apr 2004
- Location
- germany
- Posts
- 4,324
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Not sure what you're trying to do... maybe this?
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* http://www.%{HTTP_HOST}%{REQUEST_URI} [R,L]
-
Jan 20, 2005, 04:07 #7
- Join Date
- Jan 2005
- Location
- Redditch UK
- Posts
- 8
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
explaining
thanks
~~~~
to try and explain: if the hostname is "mysub" or "www.mysub" then a file called "mysub.php" is then pointed to by the .htaccess file, but I have to have it working with or without www. But if neither then index.php is pointed to.
-
Jan 20, 2005, 04:14 #8
- Join Date
- Jan 2005
- Location
- Redditch UK
- Posts
- 8
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
tried - but no good
hello
~~~
I tried what you said but with or without www. it points to index.php
I have wildcard enabled but no access to conf file. The original file works ok but with no www and I hashed it together and I am new to this so it must be written wrong.
-
Jan 20, 2005, 06:26 #9
- Join Date
- Nov 2003
- Location
- United Kingdom
- Posts
- 2,120
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by reminder
I think is is because I have got quite a few more rules within the .htaccess file, which also starts with a.Affiliate Programs Directory - Over 3,000 Programs.
----> 150+ CPA Networks | Earn upto $.75 CPM on Banner Ads
Bookmarks