LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-21-2013, 05:21 PM   #1
e11studios
LQ Newbie
 
Registered: Nov 2013
Posts: 2

Rep: Reputation: Disabled
htaccess for php clean url


I am not versed in htaccess, but I understand that I can add a code to the htaccess file and that will display cleaner urls.

The page that I am referring to is our video production faq page.

Can someone help me with this question?

Thank you
 
Old 11-22-2013, 04:50 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,548

Rep: Reputation: 136Reputation: 136
Welcome to LQ, e11studios!
What http server, apache probably? How do you want which URL to look like? Is mod_rewrite loaded? If you don't know put a script info.php in the document root of the server and call it with a browser. Here the content of the file
<?
phpinfo();

?>
 
Old 11-22-2013, 05:23 AM   #3
e11studios
LQ Newbie
 
Registered: Nov 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you for responding. You are correct, it is an apache server. It would be nice to have the url look something like "www.episodexistudios.com/category/article" or anything similar. I'm sorry that I can't give you more information, but this is all very new to me.




I have posted the contents of the current htaccess below.




# always follow the symlinks
Options +FollowSymlinks -MultiViews -Indexes

# if you want to use mod_rewrite, set this 'On'
RewriteEngine On

# the path to your faqs installation
RewriteBase /faqs/

# Maintenance Section - Uncomment the lines below according to your need
# Write below your client IP address (e.g.: 127.0.0.1)
# if you need to keep your web access during maintenance
#RewriteCond %{REMOTE_ADDR} !^127.0.0.1$
# Choose your way of closing the access to PMF:
# a. you can simply forbid access (HTTP 403 Error)
#RewriteRule ^(.*)$ underMaintenance.html [F,L]
# b. return the user an explanation
#RewriteRule ^(.*)$ underMaintenance.html [L]

# show all categories
RewriteCond %{REQUEST_URI} /showcat\.html$ [NC]
RewriteRule ^(.*)$ index.php?action=show [L,QSA]

# the search page
RewriteCond %{REQUEST_URI} /search\.html$ [NC]
RewriteRule ^(.*)$ index.php?action=search [L,QSA]

# opensearch
RewriteCond %{REQUEST_URI} /opensearch\.html$ [NC]
RewriteRule ^(.*)$ opensearch.php [L,QSA]

# the add content page
RewriteCond %{REQUEST_URI} /addcontent\.html$ [NC]
RewriteRule ^(.*)$ index.php?action=add [L,QSA]

# the ask question page
RewriteCond %{REQUEST_URI} /ask\.html$ [NC]
RewriteRule ^(.*)$ index.php?action=ask [L,QSA]

# the open questions page
RewriteCond %{REQUEST_URI} /open\.html$ [NC]
RewriteRule ^(.*)$ index.php?action=open [L,QSA]

# the help page
RewriteCond %{REQUEST_URI} /help\.html$ [NC]
RewriteRule ^(.*)$ index.php?action=help [L,QSA]

# the contact page
RewriteCond %{REQUEST_URI} /contact\.html$ [NC]
RewriteRule ^(.*)$ index.php?action=contact [L,QSA]

# the glossary page
RewriteCond %{REQUEST_URI} /glossary\.html$ [NC]
RewriteRule ^(.*)$ index.php?action=glossary [L,QSA]

# a page with a record (backward compatibility)
# * http://[...]/1_1_en.html
RewriteCond %{REQUEST_URI} ([0-9]+)_([0-9]+)_([a-z\-]+)\.html$ [NC]
RewriteRule ^(.*)_(.*)_(.*)\.html$ index.php?action=artikel&cat=$1&id=$2&artlang=$3 [L,QSA]

# a category page with page count (backward compatibility)
# * http://[...]/category1_1.html
RewriteCond %{REQUEST_URI} category([0-9]+)_([0-9]+)\.html$ [NC]
RewriteRule ^category(.*)_(.*)\.html$ index.php?action=show&cat=$1&seite=$2 [L,QSA]

# a category page (backward compatibility)
# * http://[...]/category1.html
RewriteCond %{REQUEST_URI} category([0-9]+)\.html$ [NC]
RewriteRule ^category(.*)\.html$ index.php?action=show&cat=$1 [L,QSA]

# start page
RewriteRule ^index.html$ index.php [PT]

# sitemap (backward compatibility)
RewriteCond %{REQUEST_URI} sitemap-([a-zA-Z0-9]*)_([a-z\-]+)\.html$ [NC]
RewriteRule ^sitemap-(.*)_(.*)\.html$ index.php?action=sitemap&letter=$1&lang=$2 [L,QSA]

# a solution id page
RewriteCond %{REQUEST_URI} solution_id_([0-9]+)\.html$ [NC]
RewriteRule ^solution_id_(.*)\.html$ index.php?solution_id=$1 [L,QSA]

# PMF faq record page
# * http://[...]/content/1/1/<LANGUAGE CODE>/<FAQ TOPIC>.htm
# * http://[...]/content/1/1/<LANGUAGE CODE>/<FAQ TOPIC>.html
RewriteRule content/([0-9]+)/([0-9]+)/([a-z\-]+)/(.+)\.htm(l?)$ index.php?action=artikel&cat=$1&id=$2&artlang=$3 [L,QSA]

# PMF category page with page count
# * http://[...]/category/1/<PAGE NUMBER/<CATEGORY NAME>.htm
# * http://[...]/category/1/<PAGE NUMBER/<CATEGORY NAME>.html
RewriteRule category/([0-9]+)/([0-9]+)/(.+)\.htm(l?)$ index.php?action=show&cat=$1&seite=$2 [L,QSA]

# PMF category page
# * http://[...]/category/1/<CATEGORY NAME>.htm
# * http://[...]/category/1/<CATEGORY NAME>.html
RewriteRule category/([0-9]+)/(.+)\.htm(l?)$ index.php?action=show&cat=$1 [L,QSA]

# PMF news page
# * http://[...]/news/<ID>/<LANGUAGE CODE>/<HEADER>.htm
# * http://[...]/news/<ID>/<LANGUAGE CODE>/<HEADER>.html
RewriteRule news/([0-9]+)/([a-z\-]+)/(.+)\.htm(l?)$ index.php?action=news&newsid=$1&newslang=$2 [L,QSA]

# PMF sitemap
# * http://[...]/sitemap/<LETTER>/<LANGUAGE CODE>.htm
# * http://[...]/sitemap/<LETTER>/<LANGUAGE CODE>.html
RewriteRule sitemap/([^\/]+)/([a-z\-]+)\.htm(l?)$ index.php?action=sitemap&letter=$1&lang=$2 [L,QSA]

# PMF Google sitemap
# * http://[...]/sitemap.xml
# * http://[...]/sitemap.gz
# * http://[...]/sitemap.xml.gz
RewriteRule sitemap.xml$ sitemap.xml.php [L]
RewriteRule sitemap.gz$ sitemap.xml.php?gz=1 [L]
RewriteRule sitemap.xml.gz$ sitemap.xml.php?gz=1 [L]

# PMF tags page with page count
# * http://[...]/tags/<ID>/<PAGE NUMBER>/<HEADER>.htm
RewriteRule tags/([0-9]+)/([0-9]+)/(.+)\.htm(l?)$ index.php?action=search&tagging_id=$1&seite=$2 [L,QSA]

# PMF tags page
# * http://[...]/tags/<ID>/<HEADER>.htm
RewriteRule tags/([0-9]+)/([^\/]+)\.htm(l?)$ index.php?action=search&tagging_id=$1 [L,QSA]

# the instant response page
RewriteCond %{REQUEST_URI} instantresponse\.html$ [NC]
RewriteRule ^(.*)$ index.php?action=instantresponse [L,QSA]

# rest/json API
# * http://[...]/api/<ACTION>/<LANGUAGE CODE>/<...>
RewriteRule api/getVersion api.php?action=getVersion [L,QSA]
RewriteRule api/getApiVersion api.php?action=getApiVersion [L,QSA]
RewriteRule api/search/([a-z\-]+)/([a-z\-]+)$ api.php?action=search&lang=$1&q=$2 [L,QSA]
RewriteRule api/getCategories api.php?action=getCategories [L,QSA]
RewriteRule api/getFaqs/([a-z\-]+)/([0-9]+) api.php?action=getFaqs&lang=$1&categoryId=$2 [L,QSA]
RewriteRule api/getFaq/([a-z\-]+)/([0-9]+) api.php?action=getFaq&lang=$1&recordId=$2 [L,QSA]
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
htaccess rule to change url suj Linux - Server 4 12-09-2012 09:13 AM
htaccess url rewriting dazzler20 Programming 1 12-22-2011 12:47 AM
dynamic/static url via htaccess eteck Linux - Server 3 07-07-2010 05:33 AM
URL Rewriting in htaccess hatchnet Linux - General 7 07-05-2010 05:57 PM
.htaccess domain / url forwarding max_tcs Linux - Software 1 12-17-2007 10:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration