473,406 Members | 2,843 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,406 software developers and data experts.

url rewriting

160 100+
hi to all
i am facing strange problem hopefully due to my any basic mistake
when i use code in .htaccess like this
Expand|Select|Wrap|Line Numbers
  1. RewriteRule ^d-([A-Za-z0-9-]+)?$ page.php?abc=$1 [NC,L]
  2.  
then it will work properly but when i use "/" instead of "-" then page is unable to get effect of my css file

Expand|Select|Wrap|Line Numbers
  1. RewriteRule ^d/([A-Za-z0-9-]+)?$ page.php?abc=$1 [NC,L]
  2.  
what could be the problem
Jan 30 '09 #1
4 2192
Atli
5,058 Expert 4TB
Hi.

The / char is used in URLs to indicate a directory.

So, if you rewrite an URL that includes this char to point to a different level of the directory hierarchy, any relative URLs in the file are most likely going to become invalid.

To avoid this, make sure that all links and external resources use absolute paths.

An alternative solution would be to catch any CSS file in a RewriteRule and point it to the proper location, but that can cause other, cache related problems.
Jan 31 '09 #2
I have a similar question on the same matter. I'm wonder how I can use multiple RewriteRules for different files.. currently I am only able to Rewrite one and if I use any more they either dont work or will cause an error.. here is the code I'm using:

Expand|Select|Wrap|Line Numbers
  1. <IfModule mod_rewrite.c>
  2.   Options +FollowSymlinks
  3.   RewriteEngine on  
  4.   RewriteCond %{REQUEST_FILENAME} !-f
  5.   RewriteCond %{REQUEST_FILENAME} !-d
  6.   RewriteRule ^(.*)$ link.php?get=$1 [L,QSA]
  7. </IfModule>
  8.  
I'd like to add the code below for basic actions:

Expand|Select|Wrap|Line Numbers
  1. RewriteRule ^(.*)$ index.php?do=$1 [L,QSA]
  2.  
then i'd like to have this one

Expand|Select|Wrap|Line Numbers
  1. RewriteRule ^(.*)$ index.php?do=$1&search=$2&type=$3&page=$4 [L,QSA]
  2.  
which turns out like: /search/$2

If you could give me some help as well that would be great.. I'm starting to learn this stuff but I still dont get it.. :\

Thanks guys.
Feb 22 '09 #3
Hi All,
I am also looking for a solution of URL ReWriting. i am looking to convert the url like urlname/foldername to foldername.ulsername .

but when i convert it , it dosnt show the page. please help
Mar 6 '09 #4
Kelicula
176 Expert 100+
@DeadSilent
You are searching the URI for the same match on each rewrite rule. So Apache doesn't know which one you wish to match.

This match is true if the url matches "any" character. One or more times from beginning to end of url.
RewriteRule ^(.*)$ index.php?do=$1 [L,QSA]

This one also matches the same criteria.
RewriteRule ^(.*)$ link.php?get=$1 [L,QSA]

How are you going to specify when to "do" or "get"?

Also, the capture only occurs once. So you have not populated $2, $3 etc...
The last rewrite rule will always fail.
RewriteRule ^(.*)$ index.php?do=$1&search=$2&type=$3&page=$4 [L,QSA]

Here's a good article.
Apache Mod_rewrite
Apr 11 '09 #5

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

Similar topics

6
by: Jon Maz | last post by:
Hi All, I am experimenting with URL Rewriting using the techniques outlined by Scott Mitchell in his article "URL Rewriting in ASP.NET"...
3
by: Jamie Jackson | last post by:
I'm rewriting all links' onclick events, but I'm having a problem. The onclick event that I'm inserting works correctly in Opera, but not in FF or IE. I'm retroactively adding the statement...
2
by: Jon Maz | last post by:
Hi All, I've been looking into options for URL Rewriting in .net, and to be honest, I haven't seen anything that's easier than the old Classic Asp solution with an ISAPI filter redirecting to an...
3
by: Michael Appelmans | last post by:
I'm trying to use a rule based URL rewrite application which uses HttpApplication.RewritePath. I keep getting "rsource not found" error in application when running on shared web host although the...
2
by: R-D-C | last post by:
Can these two functions coexist? We have a web site where the querystrings are removed using URL Rewriting. Instead the page appears to be a html page with a long name (containing what would be...
0
by: Lee | last post by:
Hi all ;) Preamble -------- I'm using URL rewriting to enforce a frames policy (yeah, I know frames are 'bad' :) - i.e. if a request comes in for a page which should be nested within a...
3
by: Greg Collins [Microsoft MVP] | last post by:
I have done a bit of research of Url Rewriting, but as yet have been unsuccessful at getting it to work well, and there are issues around what file types are supported and how much code you want to...
9
by: Frankie | last post by:
I understand that with URL rewriting we can have a request come in for, say Page1.aspx, and rewrite it so that PageA.aspx gets served up to the user. My question (assuming the above is correct):...
2
by: Seth Williams | last post by:
The first scenario is that I want to create one website for a particular industry - let's say for Farm Machinery so I have a shared hosting site called myFarmMachinery.com But I want to sell...
1
Shinobi
by: Shinobi | last post by:
I am using ASP.net(c#) for my project. In my my project 2 pages are using URL rewriting method by referring this article URL Rewriting using Intelligencia UrlRewriter Example 1 - Blog Day...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.