rewrite

how to generate slugs in php

hey guys im trying to write a script , that can rewrites urls in slug way such as this : http://www.mysite.com/mystorytitle/ and i did this in my codes : RewriteRule ^(.*)\/$ app=News&file=article&title=$1 [L] and in my php codes, i created a slug out of story's title as : $slug_title = mysql_real_escape_string($mtitle); ...

URL rewrite, getting error

I am having this in a .htaccess: RewriteEngine On RewriteRule ^videos/([0-9]+)/?$ vis_film.php?id=$1 [NC,L] My page is root/directory/directory/videos/vis_film.php?id=2 but i want it to be root/directory/directory/videos/2/ And ive placed the .htaccess file inside videos/, is that right? and what have i done wrong? ...

Under what situation should code be rewritten from scratch?

I know that under most situation we should avoid rewriting code from scratch. But there must be some cases where rewriting is beneficial (e.g. otherwise MS wouldn't abandon Win98/Me and develop XP from NT). What are those cases? ...

htaccess: How to redirect index.php?search= to the base url

Hi, how can i redirect index.php?search= to the base url? I tried it with this code: redirectMatch 301 ^/index.php?search=(.*) http://www.yoursite.com/ but then the page loops the code if i enter the site domain.. ...

In Apache .htaccess file using mod_rewrite, is it possible to force www AND force https for a domain ?

RewriteCond %{HTTP_HOST} !^www.example.co.uk$ [NC] RewriteRule ^(.*)$ https://www.example.co.uk/$1 [R=301,QSA,L] thats for the www, but I cannot figure out in a one-pass way how to force the https too? ...

htaccess redirection problem alias vs. directory name

When I use this rule: RewriteRule ^Chats/([^/]+)/?$ Chats/ChatPage.php?chaturl=$1 [NC] I get $_GET["chaturl"] as ChatPage.php where I should get $1. How can I solve it? If alias and directory name are not the same, there is no problem. If I use RewriteRule ^Chat/([^/]+)/?$ Chats/ChatPage.php?chaturl=$1 [NC] (NOTICE IT'S CHAT NOW NOT CH...

Wordpress: How do I convert a generated URL (permalink) to a pretty URL?

In a plugin, I am generating a paginated link to a category, i.e. http://localhost/?cat=17&paged=5. The category is known by slug and id. Is there a way to have this URL converted to the user defined "nice permalink" format, i.e. http://localhost/category/foo/page/5? (Assuming we're running Wordpress 2.8/2.9+) Edit: Since there ar...

Writing language converter in ANTLR

I'm writing a converter between some dialects of the same programming language. I've found a grammar on the net - it's complex and handles all the cases. Now I'm trying to write the appropriate actions. Most of the input is just going to be rewritten to output. What I need to do is parse function calls, do my magic (rename function, reo...

How do I rewrite a URL based on a dynamic first directory name?

My goal is to redirect: http://users.domain.com/<username>/other/path/info to http://users.domain.com/other/path/info The key here is that that the "username" in the source URL could of course be anything. Here is a more concrete example of what I want to do (and why): Suppose I have username of "bill". I want Bill to be ab...

Implement Rewrite Module to have ApplicationName with querystring

How can i rewrite the URL to have application name + querystring for example i have a web application with the following querystring mywebsite/default.aspx?UserName=xyz How can i have URL with the folllowing mywebsite?xyz i have managed to implement RewriteModule using HttpApplication on Begin_request event and currently i can use ...

nginx rewrite rule not working?

Hi, all rewrite ^/index\.asp /index.php last; rewrite ^/index\.asp\?boardid=([0-9]+)$ /forum-$1-1.html last; rewrite ^/index\.asp\?boardid=([0-9]+)(.*)$ /forum-$1-1.html last; rewrite ^/index_([0-9]+)(.*)$ /forum-$1-1.html last; rewrite ^/dispbbs\.asp\?boardID=([0-9]+)&ID=([0-9]+)$ /thread-$2-1-1.html last; I have try out rewrite rule...

What is Loglevel debug?

My error.log file for my site says Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://URL/TO/REFERER My question is, what is LogLevel? I've googled it but it seems like I'm j...

nginx 0.7.65 rewrite url with querystring problem?

Hi, all Recently, I altered my web server lighty to nginx. And now, Struggling with some problems. First, I have a site in nginx which only rewrites urls and redircts them to a new domain, and this site has exactly no file in its root directory. I put some rewrite rules (just string rules, no querystring) in my nginx.conf list 1 rewr...

problems getting nice browser url using redirect/rewriterule

Currently I use a .htaccess redirect to send a (nice) url /offices/london/whatever to my script (nasty url) /db/db.pl?offices-london-whatever i want the browser url to be nice, with the 301 redirect it isn't so i tried with the RewriteRule but the browser url is still the nasty one. e.g. RewriteRule Offices/London/(.*)$ /db/db.pl?Offic...

Wordpress and Joomla Permalinks plus domain redirect to specific subdirectory on Zeus

Hi, Here's what I'm trying to do: joomla in 1 subdirectory, wordpress in another. mysite.com directs to the joomla directory mysite.com/blog gives wordpress. I would also like to use seo friendly permalinks for both. I am using Zeus Linux shared hosting with Joomla 1.5 and wordpress 2.9.2, and having a great deal of trouble finding ...

htaccess redirect from root to subfolder and then mask the url?

Hello all, Two things: Firstly - I have version 2 of a website located in a folder named v2, and I want to redirect any traffic that is NOT a child of the v2 folder, to www.example.com/v2 The old site located in the root was created in iWeb and has a LOT of subfolders and sub-subfolders. So: www.example.com/v2 = New site www.exam...

How to perform a 301 redirect of all .php URLs to clean URLs?

My htaccess isn't quite working the way I want it to. I've seen some similar threads on here but they aren't quite what I need and I don't know enough yet about htaccess to modify the code to suit my needs. This is what I have working so far: I've got all non-www URLs redirecting to www URLs and I'm doing an internal rewrite of all URLs...

.htaccess: Allow only one Folder Structure - 301 Redirect

Hello, how can I allow only one Folder-Structure with .htaccess like that: http://www.example.com/**dynamicword**+FIXEDWORD1+FIXEDWORD2/ the dynamicword is not fix, anything else is 301: http://www.example.com/**dynamicword**+FIXEDWORD1+mistype/mistype/ --> 301 http://www.example.com/**dynamicword**+FIXEDWORD1+mistype/mistype --> 301...

How many rewrite rules should I expect to manage?

I'm dealing with a hosting team that is fairly skiddish of managing many rewrite rules. What are your experiences with the number of rules your sites are currently managing? I can see dozens (if not more) coming up as the site grows and contracts and need to set expectations that this isn't out of the norm. Thanks ...

.htaccess stupid issue

I have a server where I can only configure httpd using .htaccess, a cannot access global configuration. I want to rewrite almost every non-existing path to index.php, so I did something like: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?path=$1 [L,QSA] And that is ok. But another...