So far my page is accessible with:
mysite.com/quiz/?q=4J28S2SA
But I want the page to be accessible with just:
mysite.com/quiz/4J28S2SA
So far I have tried:
RewriteEngine On
RewriteRule ^quiz/index.php([^/]*)$ /quiz/quiz.php?q=$1 [L]
Try this :
RewriteEngine On
RewriteRule ^quiz/(.+)$ quiz/?q=$1 [L]
Related
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([a-zA-Z0-9-]+)/?$ listenAlbum.php?url=$1
RewriteRule ^([a-zA-Z0-9-]+)/category/?$ category.php?name=$1
I am having this .htaccess file
when i try to open http://mywebsite.com/my-album it works perfect
but when i try to navigate on category page like this
http://mywebsite.com/category/category-name it give a 404 Not Found
Can any one help with this ?
The second RewriteRule if your htaccess says the URL should be http://mywebsite.com/category-name/category/.
Change your htaccess to:
RewriteEngine On
RewriteRule ^([a-zA-Z0-9-]+)/?$ listenAlbum.php?url=$1
RewriteRule ^category/([a-zA-Z0-9-]+)/?$ category.php?name=$1
I have a url like:
http://x.x.x.x/~mmi/
which maps to the public_html folder on my site. I have installed cakephp on my site. The default htaccess file for cakephp looks like below:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
I want to be redirected to:
http://x.x.x.x/~mmi/app/webroot/
instead of :
http://x.x.x.x/app/webroot/~mmi/
which is happening now. How should i modify htaccess file to get this desired result?
Following does the trick:
RewriteEngine on
RewriteRule ^~mmi/(.*)$ http://x.x.x.x/~mmi/app/webroot/$1
I've wrote .htaccess file to convert urls to SEO friendly :
the original url is :
http://palestinianz.com/?page=person&p=Alex-Atalla
the content of .htaccess is :
RewriteEngine On
RewriteRule ^([^/]*)\.html$ /?page=person&p=$1 [L]
it should produce a link like this :
http://palestinianz.com/Alex-Atalla.html
But it makes no effect although I put the file in the root of my website !
where is the problem ?
If you want the URL to change in the address bar, you need to redirect the browser, then rewrite on the server. The first part of this answer explains the process that you want: https://stackoverflow.com/a/11711948/851273
So looking at the second list, the process is to redirect the browser if an ugly link is request to a nice looking link:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?page=person&p=([^\ ]+)
RewriteRule ^$ /%1.html? [R=301,L]
Now, on the server end you need to internall rewrite it back to the ugly url, which is more or less what you already have:
RewriteRule ^([^/]*)\.html$ /?page=person&p=$1 [L]
You can try:
RewriteCond %{REQUEST_URI} (.+)\.html$
RewriteRule ^(.+)\.html$ ./index.php?page=person&p=$1 [L]
Only problem with this is any .html page will go through this. May want to change to the following:
# URL: domain.com/person/Alex-Atalla.html
RewriteCond %{REQUEST_URI} (.+)/(.+)\.html$
RewriteRule ^(.+)/(.+)\.html$ ./index.php?page=$1&p=$2 [L]
This will allow you to have more robustness in changing the the page variable as well
My first question here! :) Hello!
I have some trouble with .htaccess.
http://www.domain.com/subdir/?parameter=example works.
http://www.domain.com/subdir/example doesn't work.
When i try this:
RewriteBase /subdir
RewriteRule ^index.php - [L]
RewriteRule ^([^/]+)/?$ index.php?i=$1 [R,L]
i get an 404.shtml error like http:// www.domain.com/subdir/index.php?i=404.shtml
Also the wp-admin(http:// www.domain.com/wp-admin/) redirects to the subdir with 404.shtml. How do i get the url like http:// www.domain.com/subdir/example/
Can anyone help me?? Thnx in advanced!
Assuming this is a WordPress installation (based on the mention of 'wp-admin'), you want the following
Just use the WordPress standard, put this .htaccess into the root folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdir/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subdir/index.php [L]
</IfModule>
Go to Settings and change Site address (URL) under General Settings to http://www.domain.com/subdir/
Put the following index.php into the root folder
<?php
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require('./subdir/wp-blog-header.php');
?>
Go to Settings > Permalinks and change the permalink structure to whatever you need
p.s. to access wp-admin you need to navigate to http://www.domain.com/subdir/wp-admin/
more info here: http://codex.wordpress.org/Moving_WordPress#Giving_WordPress_its_Own_Directory_While_Leaving_the_WordPress_Index_File_in_the_Root_Directory
I have a URL that looks like this http://domain.com/index.php/view/test. How do i rewrite it so it doesn't have index.php/view in it. I just want it to look like http://domain.com/test. I want users to be able to type that short url directly in the browser
I tried the following in .htaccess but it's not working
RewriteEngine on
RewriteRule ^/$ index.php/view/
I'm running php 5.2.17
RewriteBase /
RewriteCond %{REQUEST_URI} !^/index.php/view/(.*)$
RewriteRule ^(.*)$ index.php/view/$1 [L]
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.php/view/$1 [L]
Would do it if I understand you correctly.