473,624 Members | 2,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

htaccess redirect + rewrite

42 New Member
hello,
I have been looking for a solution to redirect the users to the correct urlrewrite page but I cant come up with anything thats working.

This is how I rewrite it now:
Expand|Select|Wrap|Line Numbers
  1. RewriteRule ^(search)/(.*)$ search.php?id=$2 [L]
so basically the user could search like this:
search/something

the problem is that I need to redirect them from search.php?id=s omething to search/something

I tried to add [R=301] but that didn't work, I didn't have any luck with redirect 301 either.

Any ideas on how to get this fixed?
Nov 16 '08 #1
3 2172
pbmods
5,821 Recognized Expert Expert
Heya, Gozil.

Do a print_r($_SERVE R) for each URL and see which value you can use to find out which URL the User typed in.

If I remember correctly, there are a couple of URL-related $_SERVER variables that mod_rewrite does not affect.
Nov 16 '08 #2
Gozil
42 New Member
But isn't there a way to redirect them from the .htaccess file at once?
Nov 16 '08 #3
Markus
6,050 Recognized Expert Expert
Try changing the flag to [R], although I'm not understanding your problem fully.
Mar 5 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
3683
by: Nel | last post by:
Just looking for some general advice on modifying the URL for php. I am using .htaccess to allow a web site to translate example.html to index.php?content=example (below) ErrorDocument 404 http://www.example.com RewriteEngine on RewriteRule ^/?(.*).html$ /index.php?content=$1
15
5136
by: Taki Jeden | last post by:
Hello everybody Does anybody know why w3c validator can not get pages that use 404 htaccess redirection? I set up two web sites so that clients request non-existent urls, but htaccess redirects calls to a script which parses the url and produces requested pages. It works fine with browsers, but when I try to validate the page I get a 404 error - which bewilders me, because I thought Apache does the redirection internally without sending...
5
1530
by: tommytx | last post by:
Is there any capability of decisions in htaccess. I know you can use in special situations, but I need something like: If a then b etc like in php. In other words I want to redirect the visitor to one of many pages via the htaccess file. Is there anyway to open a file and have a redirect to a different web page based on an input from a text file as below:
5
4993
by: deko | last post by:
I'm trying to redirect requests for /index.php to /mydirectory/index.php If I use an index file in / with only this line: <?php header("Location:http://www.mysite.com/mydirectory/"); ?> that seems to work. But can this be accomplished more efficiently with an htaccess rewrite?
0
2087
by: Stuart Palmer | last post by:
Hi everyone, I'm trying to look for an asp equivilent of .htaccess that is used on apache servers but for use with asp. I am doing a website and moving lots of files into a single directory to make it easier to maintain, however, I don't want to loose the search engine indexing that is already in place. What I would like to have is a db/.htacces-like files, that when a page doesn't exist the server redirect.
9
4388
by: invertigo | last post by:
Hello, Im using this .htaccess file to rewrite my websites URL. Reason i try to do this is to make it more SEO friendly. Code: -------------------------------------------------------- Options +FollowSymLinks RewriteEngine On RewriteBase mywebsite.awardspace.com
3
1654
by: Joe | last post by:
Hello, I currently have a file system where images and assets are stored in a directory like this: http://www.domain.com/assets/media/CLIENT_NAME/uploads/CLIENT_DIR/CLIENT_FILES Which holds many differents clients assets, seperated by CLIENT_NAME. This is not very elegant when my clients want to provide links to their files, so I want a way of using php (or any other method you might suggest) to make the following work:
6
8903
by: vjayis | last post by:
Hi i m using htaccess to rewrite my urls., In this instead of http://www.mysite.com/index.php i want the url as http://www.mysite.com/home/ any ideas?? and also i m using the following code to redirect to the http://www.mysite.com/index.php when a non-existing filename is typed..
1
3636
by: Lagon666 | last post by:
Hi I wanna have a htaccess file that when i go to "www.domain.com/sometext" the page redirect to "www.domain.com/user.php?user=sometext". It's important that is better that URL not end with slash. I have a problem with my htaccess file: RewriteEngine on RewriteRule ^(.+)$ user.php?user=$1 But when i go to to "http://localhost/jack" the page will redirect to "http://localhost/user.php?user=user.php". I have read this topic, but is...
0
8240
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8625
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4082
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2610
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 we have to send another system
1
1791
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.