mod-rewrite

Trailing slash

How can I add a trailing slash to: RewriteEngine on RewriteRule !\.(js|ico|gif|jpg|png|css|html)$ index.php I have tried with: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+[^/])$ $1/ [R] But it's not working ...

How can I use mod_rewrite to redirect to index.php except for assets?

I would like to have mod_rewrite go into effect for any filenames that don't exists except if that file name ends with js, css, gif, etc., so those would return regular 404s... I tried this out: RewriteCond %{REQUEST_FILENAME} \.(js|ico|gif|jpg|png|css|pdf)$ [OR] RewriteCond %{REQUEST_FILENAME} favicon.ico$ [OR] RewriteCond %{REQUEST_F...

form post to mod_rewrite url

I am trying to submit a form to the url "localhost/login". Inside my login directory I have an index.php file with the code I am using to debug that the post is working: <?php echo $_POST['username']; ?> I have a .htaccess file inside my login directory: RewriteEngine on RewriteRule ^. index.php [L] The problem is, when I post to l...

.htaccess rewrite to redirect root URL to subdirectory

Trying to get www.example.com to go directly to www.example.com/store I have tried multiple bits of code and none work. Please help! What I've tried: Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com$ RewriteRule (.*) http://www.example.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^(.+)\www.example\.co...

Simple MVC mod-rewrite

...

Subfolders and mod-rewrite

...

url rewriting an id with a string variable

trying to figure out how to rewrite this url clientside blog.com/post/how-to-get-the-ladies to point serverside to blog.com/post.php?id=123 i know how to do this: blog.com/post/123 RewriteRule ^([^/]+)/?$ post.php?id=$1 [NC,L] but how do you replace the id string with the post title slug? ...

Why isn't this rewrite rule working?

I'm using the following code in my .htaccess: Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ /$1 [R=301,L] # Special rewrite rules # ideas/<id> RewriteRule ^ideas/([0-9]+)$ idea\?id=$1 # u...

Two mod-rewrite rules

...

mod_rewrite, vhosts on Apache 2.2 (windows)

Hi there Guys. I'm currently working on a new website and want to run Elgg (Elgg.org) on it. It's fully running on PHP5 and has a lot of rewrite rules defined in the .htaccess files. On the Elgg community I didn't found / get any answers, so I will try and ask them here. I'm running multiple sites on my windows machine, now I want one ...

Why is my variable not being put into $_GET?

Hey everyone, Maybe I am missing something but I can't seem to figure this one out. I have a ReWriteRule: RewriteRule ^view/(\w+)$ view.php?mmdid=$1 [L] and when I go to mydomain.org/view/3, the $_GET array is empty. There is no key 'mmdid'. However, when I change my rule to something else, such as: RewriteRule ^viewz/(\w+)$ view....

how do I use mod_rewrite for just one file?

I want to use mod-rewrite for just one file instance: www.domain.com/contact to pull from www.domain.com/contact.php I used a rewrite rule for all files that look like a directory to do this initially but it messed up some diretory redirects I created so in the short-term, I'd rather just do it for a specific file. Thanks. ...

How to pass-through requests not going to specific directories to index.php/path?

In my present project I've got several directories: application (my MVC files, which mustn't be accessed), images, css, and js. Effectively I want all requests to images/css/js to proceed unchanged, but all others I wish to call index.php/my/path. My .htaccess currently looks like this, and is wreaking havoc with my routing. <IfModule...

What's wrong with this htaccess redirect?

Hello folks, I recently turned an old Joomla site into a Wordpress site and I want to redirect the old urls to the correct new ones. For starters I tried to redirect them all to the homepage but even that didnt work. All the old urls look like website.com/?q=node/1 (or sometimes ?q=user/ etc), so I figured this would be enough: Rewrit...

.htaccess reverse rewrite without looping?

I have an existing page called bfly.php that I need to change to butterfly-jewelry.php I want to make it so that if someone goes to the URL butterfly-jewelry.php they get the bfly.php page but the url doesn't change it stays as butterfly-jewelry.php. BUT also if someone goes directly to bfly.php the url changes to butterfly-jewelry.php ...

Mod-Rewrite Problems (Apache) with / slashes

Hey folks, I am betting on an obvious problem here I am not seeing. Here's the important bits for those of you familiar with Mod-Rewrite .htaccess file with mod-rewrite rules exists here: http://www.thedomain.com/.htaccess User goes to this URL: http://www.thedomain.com/test/blog Mod-Rewrite rules should actually tell the server to ac...

how to configure codeigniter mod_rewrite on wamp?

Hi guys could you please tell me how can I configure codeigniter mod_rewrite on wamp? I've tried enabling it through the wamp menu(wamp-->apache-->apache modules-->rewrite module) and restarting wamp but it's like nothing happened. I'm asking you guys this cause I need to get rid of the index.php in my codeigniter urls through .htacces...

Mod ReWrite Catch-All Subdomain

Basically I want *.domain.com to pull up domain.com/*/ (not redirect). I went into the subdomains section of cPanel and set a wildcard for this domain. It appears to be resolving correctly, ie *.domain.com is bringing up domain.com. I've now made a htaccess file in the public_html directory containing: Options +FollowSymLinks Options ...

Are absolute href's OK to use on production sites?

Because of some apache rewrite rules in a project I'm working on, it's convenient to make href's and links in general absolute, because that assures that the browser will find the file behind that link, no matter what the URL is. Example: <img src="http://localhost/project/gfx/abc.jpg"&gt;&lt;/img&gt; instead of <img src="gfx/abc...

mod_rewrite

Hi My current code is something like this store.php?storeid=12&page=3 and I'm looking to translate it to something like this mysite.com/roberts-clothing-store/store/12/3 and something like this: profile.php?userid=19 to mysite.com/robert-ashcroft/user/19 I understand that it's best to have the SEO-friendly text as far left a...