473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

htaccess redirect + rewrite

42
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=something 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 2159
pbmods
5,821 Expert 4TB
Heya, Gozil.

Do a print_r($_SERVER) 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
But isn't there a way to redirect them from the .htaccess file at once?
Nov 16 '08 #3
Markus
6,050 Expert 4TB
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
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...
15
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...
5
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...
5
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...
0
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...
9
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...
3
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...
6
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...
1
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....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.